title: Autowire a parameterized constructor in spring boot
body: <p>I am not able to autowire a bean while passing values in paramterized constructor.</p>
  
  <p>How to call the parameterized constructor using SpringBoot?</p>
  
  <pre class="lang-java prettyprint-override"><code>@Component
  public class MainClass {
  
      public void someTask() {
          AnotherClass obj = new AnotherClass(1, 2);
      }
  
  }
  //Replace the new AnotherClass(1, 2) using Autowire?
  
  @Component
  public class AnotherClass {
      private int number,age;
  
      public AnotherClass(int number, int age) {
          super();
          this.number = number;
          this.age = age;
      }
  }
  </code></pre>
  
  <p>I want to autowire "AnotherClass" bean.
  How to remove the <code>new AnotherClass(1, 2);</code>
  How can I place <code>@Autowire</code> here?</p>