diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java
index 93102918b82..d5562625949 100644
--- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java
+++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java
@@ -370,7 +370,7 @@ public class XmlConfiguration
throw new IllegalStateException("No suitable constructor on " + oClass, x);
}
}
-
+
configure(obj, _config, index);
return obj;
}
@@ -437,6 +437,8 @@ public class XmlConfiguration
case "Property":
propertyObj(node);
break;
+ case "Arg": // Arg should have been processed for Configure already so ignore it here
+ break;
default:
throw new IllegalStateException("Unknown tag: " + tag + " in " + _url);
}
@@ -757,7 +759,10 @@ public class XmlConfiguration
/*
* Create a new value object.
*
- * @param obj @param node @return @exception Exception
+ * @param obj
+ * @param node
+ *
+ * @return @exception Exception
*/
private Object newObj(Object obj, XmlParser.Node node) throws Exception
{
diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/AnnotatedTestConfiguration.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/AnnotatedTestConfiguration.java
new file mode 100644
index 00000000000..5a5c759cc98
--- /dev/null
+++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/AnnotatedTestConfiguration.java
@@ -0,0 +1,50 @@
+package org.eclipse.jetty.xml;
+
+import org.eclipse.jetty.util.annotation.Name;
+
+public class AnnotatedTestConfiguration
+{
+ private String first;
+ private String second;
+ private String third;
+
+ public AnnotatedTestConfiguration(@Name("first") String first, @Name("second") String second, @Name("third") String third)
+ {
+ this.first = first;
+ this.second = second;
+ this.third = third;
+ }
+
+ public String getFirst()
+ {
+ return first;
+ }
+
+ public void setFirst(String first)
+ {
+ this.first = first;
+ }
+
+ public String getSecond()
+ {
+ return second;
+ }
+
+ public void setSecond(String second)
+ {
+ this.second = second;
+ }
+
+ public String getThird()
+ {
+ return third;
+ }
+
+ public void setThird(String third)
+ {
+ this.third = third;
+ }
+
+
+
+}
diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java
index c0d7f7a25e6..939852a0c46 100644
--- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java
+++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java
@@ -342,4 +342,86 @@ public class XmlConfigurationTest
xmlConfiguration.configure(tc);
Assert.assertEquals("tc.map is has two entries as specified in the XML", 2, tc.map.size());
}
+
+ @Test
+ public void testConstructorNamedInjection() throws Exception
+ {
+ XmlConfiguration xmlConfiguration = new XmlConfiguration("" +
+ "" +
+ " arg1 " +
+ " arg2 " +
+ " arg3 " +
+ "");
+
+ AnnotatedTestConfiguration atc = (AnnotatedTestConfiguration)xmlConfiguration.configure();
+
+ Assert.assertEquals("first parameter not wired correctly","arg1", atc.getFirst());
+ Assert.assertEquals("second parameter not wired correctly","arg2", atc.getSecond());
+ Assert.assertEquals("third parameter not wired correctly","arg3", atc.getThird());
+ }
+
+ @Test
+ public void testConstructorNamedInjectionOrdered() throws Exception
+ {
+ XmlConfiguration xmlConfiguration = new XmlConfiguration("" +
+ "" +
+ " arg1 " +
+ " arg2 " +
+ " arg3 " +
+ "");
+
+ AnnotatedTestConfiguration atc = (AnnotatedTestConfiguration)xmlConfiguration.configure();
+
+ Assert.assertEquals("first parameter not wired correctly","arg1", atc.getFirst());
+ Assert.assertEquals("second parameter not wired correctly","arg2", atc.getSecond());
+ Assert.assertEquals("third parameter not wired correctly","arg3", atc.getThird());
+ }
+
+ public void testConstructorNamedInjectionUnOrdered() throws Exception
+ {
+ XmlConfiguration xmlConfiguration = new XmlConfiguration("" +
+ "" +
+ " arg1 " +
+ " arg3 " +
+ " arg2 " +
+ "");
+
+ AnnotatedTestConfiguration atc = (AnnotatedTestConfiguration)xmlConfiguration.configure();
+
+ Assert.assertEquals("first parameter not wired correctly","arg1", atc.getFirst());
+ Assert.assertEquals("second parameter not wired correctly","arg2", atc.getSecond());
+ Assert.assertEquals("third parameter not wired correctly","arg3", atc.getThird());
+ }
+
+ public void testConstructorNamedInjectionOrderedMixed() throws Exception
+ {
+ XmlConfiguration xmlConfiguration = new XmlConfiguration("" +
+ "" +
+ " arg1 " +
+ " arg2 " +
+ " arg3 " +
+ "");
+
+ AnnotatedTestConfiguration atc = (AnnotatedTestConfiguration)xmlConfiguration.configure();
+
+ Assert.assertEquals("first parameter not wired correctly","arg1", atc.getFirst());
+ Assert.assertEquals("second parameter not wired correctly","arg2", atc.getSecond());
+ Assert.assertEquals("third parameter not wired correctly","arg3", atc.getThird());
+ }
+
+ public void testConstructorNamedInjectionUnorderedMixed() throws Exception
+ {
+ XmlConfiguration xmlConfiguration = new XmlConfiguration("" +
+ "" +
+ " arg3 " +
+ " arg2 " +
+ " arg1 " +
+ "");
+
+ AnnotatedTestConfiguration atc = (AnnotatedTestConfiguration)xmlConfiguration.configure();
+
+ Assert.assertEquals("first parameter not wired correctly","arg1", atc.getFirst());
+ Assert.assertEquals("second parameter not wired correctly","arg2", atc.getSecond());
+ Assert.assertEquals("third parameter not wired correctly","arg3", atc.getThird());
+ }
}