Alex opened SPR-16888 and commented
I have several @Component
implementing an interface I1, and I've a @Service
with an @autowired
List\
All of those components and services have a @PostConstruct
where they autoconfigure based on configuration properties.
The problem is that while executing the @PostConstruct
in the @Service
component, sometimes the @PostConstruct
of his injected components has not yet been called.
To be more clear: my service correctly gets the list of all components implementing a certain interface, but sometimes (randomly), they are not completely initialized when executing his @PostConstruct
method.
Affects: 5.0.6
Comment From: spring-projects-issues
Juergen Hoeller commented
It would be great to have a reproducible test case for this. Injection of incompletely initialized bean instances may only really happen in circular reference scenarios, and if at all then in a well-defined order. If you see random occurrences here, there must be some other factor involved: possibly the order of class detection in a classpath scan... or some other external factor that influences bean registration order on startup.
Comment From: spring-projects-issues
Alex commented
How am I supposed to do that?
My own application, if run on a server behaves in a way (bean initialization is correct), and on another server in another way, not working.
Maybe it depends on the number of cores and/or performance?
Comment From: snicoll
Without a reproducer, we can't really proceed with the issue. If you had managed to reproduce a small sample in an environment and not in another, this might be enough for us to spot what the issue could have been.