title: Making default bean constructor public is not instantiated in spring
body: <p>I am new to spring. I created one bean class and a configuration file as below :</p>
  
  <p><strong>Beans.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
  
      &lt;bean id="employee" class="com.asd.bean.Employee"&gt;
          &lt;constructor-arg index="0" type="java.lang.String" value="kuldeep" /&gt;
          &lt;constructor-arg index="1" type="java.lang.String" value="1234567" /&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>Employee.java</strong></p>
  
  <pre><code>package com.asd.bean;
  
  public class Employee {
  
      private String name;
      private String empId;
  
      public Employee() {
          System.out.println("Employee no-args constructor");
      }
  
      Employee(String name, String empId)
      {
          System.out.println("Employee 2-args constructor");
      this.name=name;
      this.empId=empId;
      }
  
      /**
       * @return the name
       */
      public String getName() {
          return name;
      }
  
      /**
       * @param name the name to set
       */
      public void setName(String name) {
          this.name = name;
      }
  
      /**
       * @return the empId
       */
      public String getEmpId() {
          return empId;
      }
  
      /**
       * @param empId the empId to set
       */
      public void setEmpId(String empId) {
          this.empId = empId;
      }
  
      public String toString() {
          return "Name : "+name+"\nEID : "+empId; 
  
      }
  
  }
  </code></pre>
  
  <p>when I am trying to get bean using ApplicationContext it is giving following exception :</p>
  
  <p><strong>Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employee' defined in class path resource [Problem.xml]: 2 constructor arguments specified but no matching constructor found in bean 'employee' (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)</strong></p>
  
  <p>Now if i removes the public from default constructor it works fine and even in case of making both constructors public also it is working. Please explain why it is showing this behaviour???</p>
  
  <p>Thanks in Advance.</p>