Jeffrey Schultz opened SPR-17251 and commented
I am interested in having the ability to use either XML or Java Config to register implementations of the EventListener with components that provide addXXXListener(XXXListener) and removeXXXListener(XXXListener) methods. The EventListener registrations should follow the bean lifecycle and unregister themselves with the event source when being disposed.
I know that a custom bean could be developed that can handle invocations of the addXXXListener/removeXXXListener methods and pass a reference of the EventListener object, but would like to see what the Spring team thinks of this feature.
Even if you decide this doesn't fall inline with the overall direction of Spring, could you at least provide some pointers that I could follow to investigate its implementation? The Application Event support is great, but I am looking for a more point to point way of handling messaging within applications. I could take the Spring Integration approach, but I feel this would be overkill for this particular implementation.
No further details from SPR-17251
Comment From: snicoll
ConfigurableApplicationContext
has addApplicationListener
and removeApplicationListener
that you can use in your own components. I may have misunderstood what you'd like to achieve though so please report back and we can reopen accordingly.