Prototype beans that implement ApplicationListener shouldn't be created during container initialization [SPR-5247] #9921
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Denis Zhdanov opened SPR-5247 and commented
Consider that the client specifies particular bean with the scope prototype and that bean implements org.springframework.context.ApplicationListener. The bean instance is created during context instantiation then. The reason is that org.springframework.context.support.AbstractApplicationContext.registerListeners() calls getBeansOfType(ApplicationListener.class, true, false). The bug is that second parameter is set to true.
This is a major defect because the client may specify the bean to reference to resource that can't be available at the start time. Hence, spring context is failed to be constructed.
Affects: 2.5.5
Issue Links:
The text was updated successfully, but these errors were encountered: