Skip to content

Instantly share code, notes, and snippets.

@couragecowardlydog
Last active August 27, 2023 13:31
Show Gist options
  • Save couragecowardlydog/1facd357b699794c7fc7800eb8e5a53b to your computer and use it in GitHub Desktop.
Save couragecowardlydog/1facd357b699794c7fc7800eb8e5a53b to your computer and use it in GitHub Desktop.
@Component
@Scope(value = "prototype")
public class UserContextHolder extends ContextHolder {
}
@Component
@AllArgsConstructor
public class ReportGenerator {
@Autowired
@Qualifier("userContextHolder")
private ContextHolder contextHolder;
public void run(IReport report) {
// some code that is dependent on contextHolder
report.generate(...args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment