-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Introduce removeApplicationListener in ConfigurableApplicationContext #14023
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
Comments
Archie Cobbs commented Additional info: even though these
That is why they have to be manually registered as listeners. So this is kind-of a Catch-22 situation. By the way, this issue relates to #9922, which is marked Resolved, but is it really? It seems like the code above means that it's not really resolved. Also: I accidentally set the Component to SpringAOP instead of SpringCore, but don't have permission to edit it... sorry. |
Archie Cobbs commented Related to this. There is an opportunity for a little API cleanup:
|
Bulk closing outdated, unresolved issues. Please, reopen if still relevant. |
... except Github won't let me reopen it... |
This feature was also considered in conjunction with the initial implementation for #25616. |
Scheduling for 6.0 with a chance to explore a backport to 5.3.x. |
Woo-hoo! Just in time for it's 10th birthday on Sunday :) Seriously, this is why I love Spring - most projects would never bother to fix a 10 year old minor feature request. |
Uh oh!
There was an error while loading. Please reload this page.
Archie Cobbs opened SPR-9387 and commented
I have some object which need to receive some
ApplicationEvents
that are sent around in my application.However, these objects have a lifecycle that does not match with the lifecycle of normal beans in the application context (their lifecycle is shorter).
Therefore, I have these beans marked
@Configurable
, and they areApplicationContextAware
so they can get a reference to the application context (which is assumed to be aConfigurableApplicationContext
.Then, when they "start" they register as listeners for application events via
ConfigurableApplicationContext.addApplicationListener()
. However, when they "stop" there is no way for them to unregister themselves as listeners, because there is no corresponding methodConfigurableApplicationContext.removeApplicationListener()
.So this request is simply to add
ConfigurableApplicationContext.removeApplicationListener()
.If there is some more elegant way to do what I'm trying to do please let me know. But just from the face of it, it seems weirdly asymmetrical to have a public
addFooListener()
method without a correspondingremoveFooListener()
method.Thanks.
Affects: 3.1.1
Issue Links:
@Configurable
beans using weak references1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: