title: Autowire Bean with constructor parameters
body: <p>I've got a bean with constructor parameters which I want to autowire into another bean using annotations. If I define the bean in the main config and pass in the constructor parameters there then it works fine. However, I have no main config but use <code>@Component</code> along with <code>@ComponentScan</code> to register the beans. I've tried using <code>@Value</code> property to define the parameters but then I get the exception  <strong>No default constructor found;</strong></p>
  <pre><code>@Component
  public class Bean {
  
      private String a;
      private String b;
      
      public Bean(@Value(&quot;a&quot;) String a, @Value(&quot;b&quot;) String b)
      {
          this.a = a;
          this.b = b;
      }
      
      public void print()
      {
          System.out.println(&quot;printing&quot;);
      }
      
  }
  
  
  @Component
  public class SecondBean {
  
      private Bean bean;
      
      @Autowired
      public SecondBean(Bean bean)
      {
          this.bean = bean;
      }
      
      public void callPrint()
      {
          bean.print();
      }
      
  }
  </code></pre>