title: How to Autowire a Component which is having constructor with arguments in SpringBoot Application
body: <p>I have a class having Autowired Constructor.</p>
  
  <p>now when i am autowiring this class object in my class. how do i pass arguments for constructor??</p>
  
  <p>example code:
  <strong>Class having Autowired Constructor:</strong></p>
  
  <pre><code>@Component
  public class Transformer {
      private String dataSource;
      @Autowired
      public Transformer(String dataSource)
      {
          this.dataSource = dataSource;
      }
  }
  </code></pre>
  
  <p><strong>Class using autowire for component having constructor with arguments:</strong></p>
  
  <pre><code>@Component
      public class TransformerUser {
          private String dataSource;
          @Autowired
          public TransformerUser(String dataSource)
          {
              this.dataSource = dataSource;
          }
          @Autowired
          Transformer transformer;
  
      }
  </code></pre>
  
  <p>this code fails with message </p>
  
  <blockquote>
    <p>"Unsatisfied dependency expressed through constructor parameter 0"</p>
    
    <p>while creating bean of type Transformer.</p>
  </blockquote>
  
  <p>how do i pass the arguments to Transformer while Autorwiring it??</p>