diff --git a/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java b/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java index 24d388e3b..dd61d811d 100644 --- a/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java +++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java @@ -219,7 +219,21 @@ public class XmlConfigurationProvider implements ConfigurationProvider { final String nodeName = child.getNodeName(); - if ("bean".equals(nodeName)) { + if ("bean-provider".equals(nodeName)) { + String name = child.getAttribute("name"); + String impl = child.getAttribute("class"); + try { + Class classImpl = ClassLoaderUtil.loadClass(impl, getClass()); + if (classImpl.isAssignableFrom(ConfigurationProvider.class)) { + ConfigurationProvider provider = (ConfigurationProvider) classImpl.newInstance(); + provider.register(containerBuilder, props); + } else { + throw new ConfigurationException("The bean-provider: name:" + name + " class:" + impl + " doesnt implement " + ConfigurationProvider.class.getName(), childNode); + } + } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { + throw new ConfigurationException("Unable to load bean-provider: name:" + name + " class:" + impl, e, childNode); + } + } else if ("bean".equals(nodeName)) { String type = child.getAttribute("type"); String name = child.getAttribute("name"); String impl = child.getAttribute("class"); @@ -233,8 +247,6 @@ public class XmlConfigurationProvider implements ConfigurationProvider { scope = Scope.REQUEST; } else if ("session".equals(scopeStr)) { scope = Scope.SESSION; - } else if ("singleton".equals(scopeStr)) { - scope = Scope.SINGLETON; } else if ("thread".equals(scopeStr)) { scope = Scope.THREAD; } diff --git a/core/src/main/resources/struts-2.6.dtd b/core/src/main/resources/struts-2.6.dtd new file mode 100644 index 000000000..6eb565440 --- /dev/null +++ b/core/src/main/resources/struts-2.6.dtd @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/velocity/src/main/resources/struts-plugin.xml b/plugins/velocity/src/main/resources/struts-plugin.xml index 00a4207f4..04842de48 100644 --- a/plugins/velocity/src/main/resources/struts-plugin.xml +++ b/plugins/velocity/src/main/resources/struts-plugin.xml @@ -20,10 +20,13 @@ */ --> + "-//Apache Software Foundation//DTD Struts Configuration 2.6//EN" + "http://struts.apache.org/dtds/struts-2.6.dtd"> + + +