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
{{ message }}
Repository navigation
Avoid creation of lazy candidates when the primary bean is injected [SPR-14611] #19178
Later on, someone injects the primary bean as follows:
@InjectprivateExecutorServiceexecutorService;
The expectation is for the primary bean to be constructed and injected at this point, but for the other two beans not to be constructed yet (as they are lazy). What seems to happen, however, is that all three beans are constructed at this point (albeit the primary bean is successfully injected).
Please note that this issue seems to be quite similar to #18314
I've addressed this through a revision of DefaultListableBeanFactory's resolution algorithms, only resolving bean instances when already available and otherwise operating against the bean type until an instance has actually been selected for exposure. This still allows for proper introspection of primary candidates and priority values but does not trigger unnecessary bean creation.
Activity
spring-projects-issues commentedon Aug 24, 2016
Juergen Hoeller commented
I've addressed this through a revision of
DefaultListableBeanFactory's resolution algorithms, only resolving bean instances when already available and otherwise operating against the bean type until an instance has actually been selected for exposure. This still allows for proper introspection of primary candidates and priority values but does not trigger unnecessary bean creation.