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

ApplicationListener beans eagerly instantiated even when marked as lazy-init [SPR-4054] #8733

Closed
spring-projects-issues opened this issue Nov 6, 2007 · 2 comments
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 Nov 6, 2007

Mathew Wyatt opened SPR-4054 and commented

When i have a "prototype" (defined as prototype in the spring-config) bean which implements the ApplicationContextAware interface, it is eagerly instantiated when the application context is loaded. Which means i have a bean floating around in space which i can not get reference to. It seems poor practice to have a floating unreferenced (unreferenced by me explicitly) bean floating around?... In my case, the floating bean is throwing runtime exceptions, because of dependencies on a swing ancestor component...

see post - http://forum.springframework.org/showthread.php?t=44522&highlight=ApplicationContextAware


Affects: 2.0.7

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

We unfortunately can't change the present behavior easily. If those semantics don't work for you, then you'll need to use some other mechanism, not implementing ApplicationListener...

We'll revisit the ApplicationListener model for Spring 3.0.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

bernard patteeuw commented

I have exactly the same problem ... would be nice in the future

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