Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Oct 29, 2008 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 29, 2008

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:

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

The ApplicationListener facility is unfortunately not decided as a supporting interface at present; it's rather indicating a fundamentally special type of bean that will be obtained in special ways. We'll reconsider that for Spring 3.0, making it more intuitive from a non-singleton perspective.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants