Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Dispatcher Listener |
Use a DispatcherListener to hook up to event when a Dispatcher is initalized and destroyed. This is an easy way to associate customizable components like a ConfigurationManager with a Dispatcher.
static { Dispatcher.addDispatcherListener(new DispatcherListener() { public void dispatcherInitialized(Dispatcher du) { // do something to Dispatcher after it is initialized eg. du.setConfigurationManager(....); } public void dispatcherDestroyed(Dispatcher du) { // do some cleanup after Dispatcher is destroyed. } }); }