title: In what order does the Spring take the values in constructor-args
body: <p>I tried Constructor Injection of DI. This piece of code is working fine even if I don't specify the <code>type</code> in <code>&lt;constructor-arg&gt;</code>.  </p>
  
  <p>Triangle class: </p>
  
  <pre><code>public class Triangle {
  
      private String type;
      private int height;
  
      public Triangle(int height) {
          this.height = height;
      }
  
      public Triangle(String type, int height) {
          this.type = type;
          this.height = height;
      }
  
      public Triangle(String type) {
          this.type = type;
      }
  
      public void draw(){
          System.out.println(getType()+ " Triangle drawn with height = "+getHeight());
      }
  
      public String getType() {
          return type;
      }
  
      public int getHeight() {
          return height;
      }
  }
  </code></pre>
  
  <p>Configuration file, spring.xml: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"&gt;
  
  &lt;beans&gt;
      &lt;bean id = "triangle" class = "model.Triangle"&gt;
          &lt;constructor-arg value = "Isosceles"/&gt; 
          &lt;constructor-arg value = "20" /&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>Driver class (<code>main</code> method) :</p>
  
  <pre><code>public class Driver {
  
      public static void main(String[] args) {
  
          ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
          Triangle triangle = (Triangle) context.getBean("triangle");
          triangle.draw();
      }
  }
  </code></pre>
  
  <p>But, when I tried the lines of <code>&lt;constructor-arg&gt;</code> interchangeably in the <code>spring.xml</code>, an Exception was thrown as follows: </p>
  
  <pre><code>Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'triangle' defined in class path resource [spring.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
  </code></pre>
  
  <p>I'm not able to figure out in what order <strong>Spring</strong> takes the values from the <code>&lt;constructor-arg&gt;</code>.</p>