/** * Get the current list of ConfigurationProviders. If no custom ConfigurationProviders have been added, this method * will return a list containing only the default ConfigurationProvider, XMLConfigurationProvider. if a custom * ConfigurationProvider has been added, then the XmlConfigurationProvider must be added by hand. * </p> * <p/> * TODO: the lazy instantiation of XmlConfigurationProvider should be refactored to be elsewhere. the behavior described above seems unintuitive. * * @return the list of registered ConfigurationProvider objects * @see ConfigurationProvider */ public List<ContainerProvider> getContainerProviders() { providerLock.lock(); try { if (containerProviders.size() == 0) { containerProviders.add(new XWorkConfigurationProvider()); containerProviders.add(new XmlConfigurationProvider("xwork.xml", false)); } return containerProviders; } finally { providerLock.unlock(); } }
public Object getObject() throws Exception { ConfigurationManager confManager = new ConfigurationManager(); confManager.addContainerProvider(new XWorkConfigurationProvider()); SpringContainer springContainer = new SpringContainer(); springContainer.setApplicationContext(_context); confManager.addContainerProvider(springContainer); for (String xmlConfigurationSource : _xmlConfigurationSources) { XmlConfigurationProvider xml = new XmlConfigurationProvider( xmlConfigurationSource, true); xml.setThrowExceptionOnDuplicateBeans(false); confManager.addContainerProvider(xml); } return confManager.getConfiguration(); }