Closed
Description
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:
- ApplicationListener beans eagerly instantiated even when marked as lazy-init [SPR-4054] #8733 ApplicationListener beans eagerly instantiated even when marked as lazy-init
- Prototype application context event listeners are not notified within the events [SPR-5248] #9922 Prototype application context event listeners are not notified within the events