title: Inject parameters to constructor through annotation in Spring
body: <p>I am using Spring Boot annotation configuration. I have a class whose constructor accepts 2 parameters (string, another class).</p>
  
  <p>Fruit.java</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Fruit {
      public Fruit(String FruitType, Apple apple) {
              this.FruitType = FruitType;
              this.apple = apple;
          }
  }
  </code></pre>
  
  <p>Apple.java</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Apple {
  
  }
  </code></pre>
  
  <p>I have a class  that needs to autowire the above class by injecting parameters to the constructor("iron Fruit",Apple class)</p>
  
  <p>Cook.java</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Cook {
  
      @Autowired
      Fruit applefruit;
  }
  </code></pre>
  
  <p>The cook class need to autowire Fruit class with parameters("iron Fruit",Apple class)</p>
  
  <p>The XML configuration looks like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;bean id="redapple" class="Apple" /&gt;
  &lt;bean id="greenapple" class="Apple" /&gt;
  &lt;bean name="appleCook" class="Cook"&gt;
            &lt;constructor-arg index="0" value="iron Fruit"/&gt;
            &lt;constructor-arg index="1" ref="redapple"/&gt;
  &lt;/bean&gt;
  &lt;bean name="appleCook2" class="Cook"&gt;
            &lt;constructor-arg index="0" value="iron Fruit"/&gt;
            &lt;constructor-arg index="1" ref="greenapple"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>How to achieve it using annotation configuration only?</p>