|
From: Keith D. <kei...@in...> - 2004-07-13 03:56:25
|
I have a need to inject a handle to an application context's application event multicaster for the purpose of wiring up application listeners that are instantiated post-startup -- programatically -- within my application. I need this to happen automagically, e.g where the user doesn't have to remember to do this. What's the best way to achieve this? The best I can come up with is to require manual instantation of an ApplicationEventMulticaster bean in the context, and inject it automatically using a BeanPostProcessor (e.g ApplicationEventMulticasterAware). Is there anyway to get a handle to the default multicaster associated with an ApplicationContext after the application has started? I've considered just having the container instantiate the ApplicationListener objects in question, but I really want control over the instantation process--I have to make sure these objects are prototypes, and I'm slightly concerned about users forgetting to mark them 'singleton=false' within the context.. this option is not out, but I am preferring using another object as the "container / factory" for the prototypes it produces to simplify what the user has to configure... (it's the view descriptor / view case I emailed on earlier --> view descriptors produce view instances, views are prototypes and typically are application event listeners...) Thanks, Keith |