You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In PostConstruct i make a call for subscribe to event ( in external system)
I use webclient and tracing ( spring cloud sleuth)
I got deadlock in DefaultSingletonBeanRegistry.getSingleton method. When webclient try to make a call. By default weblient use reactor.netty.http.brave.TracingHttpClientDecorator. After this application try to get and create singleton bean org.springframework.cloud.sleuth.autoconfig.brave.BraveSamplerConfiguration$RefreshScopedSamplerConfiguration and try to get "synchronized (this.singletonObjects)" in DefaultSingletonBeanRegistry.getSingleton
The text was updated successfully, but these errors were encountered:
You shouldn't do stuff like this in a @PostConstruct method, bean construction hasn't completely finished at that point and using other beans that might themselves not be fully initialized can cause these problems.
Wait for the context to be ready to use and then do your call. If you're using Spring Boot, you can use an event listener:
@EventListener(ApplicationReadyEvent.class)
publicvoidready() {
// webClient call here
}
Or have your bean implement CommandLineRunner, which will have it be invoked automatically once the context is ready to use.
It's indeed not a good idea. You could use SmartInitializationSingleton instead as afterSingletonInstantied provides a better callback for things like.
Found it in 5.3.22
In PostConstruct i make a call for subscribe to event ( in external system)
I use webclient and tracing ( spring cloud sleuth)
I got deadlock in DefaultSingletonBeanRegistry.getSingleton method. When webclient try to make a call. By default weblient use reactor.netty.http.brave.TracingHttpClientDecorator. After this application try to get and create singleton bean org.springframework.cloud.sleuth.autoconfig.brave.BraveSamplerConfiguration$RefreshScopedSamplerConfiguration and try to get "synchronized (this.singletonObjects)" in DefaultSingletonBeanRegistry.getSingleton
The text was updated successfully, but these errors were encountered: