-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc: Avoid deadlock in @PostConstruct
through SmartInitializingSingleton
or ContextRefreshedEvent
#25074
Comments
On second thought, my scenario seems to be better suited to use |
Sorry for back and forth, but I want a hook before application start-up, but handling it in |
This commit also adds sleep to ApplicationListener.onApplicationEvent() to see if it's blocking application start-up. See spring-projects/spring-framework#25074 (comment)
For such a scenario, your bean should either implement Alternatively, you may implement the I'll turn this into a documentation ticket for such purposes. |
@PostConstruct
through SmartInitializingSingleton
or ContextRefreshedEvent
Affects: 5.2.6.RELEASE
The following scenario triggers deadlock:
@Repository
bean in@PostConstruct
block.@PostConstruct
block.This is a sample project to demonstrate it: https://github.com/izeye/spring-boot-throwaway-branches/tree/post-construct-deadlock
Just running it will trigger deadlock.
I'm not sure if this is unsupported usage or bug.
The text was updated successfully, but these errors were encountered: