Skip to content

Prototype beans that implement ApplicationListener shouldn't be created during container initialization [SPR-5247] #9921

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions