The ConfigurationProvider interface describes the framework‘s configuration. By default, the framework loads its configurations via an XML document by using the StrutsXmlConfigurationProvider
. The provider can be configured through a Dispatcher’s DispatcherListener.
static { Dispatcher.addDispatcherListener(new DispatcherListener() { .... public void dispatcherInitialized(Dispatcher du) { ConfigurationManager confManager = du.getConfigurationManager(); confManager.addConfigurationProvider( ... ); } .... }); }
ConfigurationProvider
is the basic piece of configuration used to tie all the options together in ConfigurationManager
. There is few different implementations that are already used internally by the Apache Struts:
XmlDocConfigurationProvider
- an abstract based implementation which can use XML documents from any source as configurationXmlConfigurationProvider
- an abstract based implementation which can use XML files on disk as source of configurationStrutsXmlConfigurationProvider
- primary configuration provider, represents struts.xml
, struts-plugin.xml
and struts-deferred.xml
filesPropertiesConfigurationProvider
- used to load struts.properties
-ServletContextAwareConfigurationProvider
- marking interface allowing to inject ServletContext
into providerTo inject your custom configuration provider use configProviders
<init-param/>
in web.xml