title: Why Spring throws exceptions when No default constructor is found
body: <p>A simple test Shopping Application where i have two classes Clothing and Offers.
  Now on calling <em>formalshirt</em> bean, it throws the following exception</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'DiwaliOffer' defined in class path resource [spring.xml]: Instantiation of bean failed; 
  nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [Offers]: No default constructor found; 
  nested exception is java.lang.NoSuchMethodException: Offers.&lt;init&gt;()
  </code></pre>
  
  <p>Now if i comment the Offers constructor, the app runs successfully. My query is Why does Spring looks for default constructor only when there is another constructor?</p>
  
  <p><strong>Clothing Class</strong></p>
  
  <pre><code>public class Clothing {
      private int price;
      private List&lt;Offers&gt; offer;
  
      public void setOffer(List&lt;Offers&gt; offer) {
          this.offer = offer;
      }
  
      public void setPrice(int price) {
          this.price = price;
      }
  }
  </code></pre>
  
  <p>. </p>
  
  <p><strong>Offers Class</strong></p>
  
  <pre><code>public class Offers {
      private int discount;
      private String promocode;
  
      public Offers(int val1, String val2)
      {
          this.discount=val1;
          this.promocode=val2;
      }
  
      //public Offers(){} /*Default Constructor added due to Spring Exception as in below */  
      /* Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class No default constructor found */
      /* Caused by: java.lang.NoSuchMethodException: com.test.Shopping.Offers.&lt;init&gt;() */
  
      public void setDiscount(int discount) {
          this.discount = discount;
      }
  
      public void setPromocode(String promocode) {
          this.promocode = promocode;
      }
  }
  </code></pre>
  
  <p><strong>Spring.xml</strong></p>
  
  <pre><code>&lt;bean id="formalshirt" class="com.test.Shopping.Clothing"&gt;
      &lt;property name="price" value="800"&gt;&lt;/property&gt;              
      &lt;property name="offer"&gt;
          &lt;list&gt;
              &lt;ref bean="DiwaliOffer" /&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;bean id="DiwaliOffer" class="com.test.Shopping.Offers"&gt;
      &lt;property name="discount" value="10"&gt;&lt;/property&gt;
      &lt;property name="promocode" value="diwali"&gt;&lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>