title: Spring Bean - Constructor with arguments
body: <p>I see an error in the constructor which says </p>
  
  <blockquote>
    <p>"String queueName" cannot be autowired. </p>
  </blockquote>
  
  <p>I have <code>AmazonSQSAsync</code> component defined in another class but not
  <code>queueName</code>. Why is the constructor trying to autowire the parameters
  and how can I resolve this?</p>
  
  <pre><code>@Configuration
  public class SqsQueueHealthIndicator extends AbstractHealthIndicator {
  
      private final AmazonSQSAsync amazonSQSAsync;
      private final String queueName;
  
      public SqsQueueHealthIndicator(AmazonSQSAsync amazonSQSAsync, String queueName) {
          this.amazonSQSAsync = amazonSQSAsync;
          this.queueName = queueName;
      }
  
      @Override
      protected void doHealthCheck(Health.Builder builder) {
          try {
              amazonSQSAsync.getQueueUrl(queueName);
              builder.up();
          } catch (QueueDoesNotExistException e) {
              builder.down(e);
          }
      }
  
      @Bean
      SqsQueueHealthIndicator queueHealthIndicator(@Autowired AmazonSQSAsync amazonSQSAsync, @Value("${url}") String queueName) {
          return new SqsQueueHealthIndicator(amazonSQSAsync, queueName);
      }
  
      @Bean
      SqsQueueHealthIndicator deadLetterQueueHealthIndicator(@Autowired AmazonSQSAsync amazonSQSAsync, @Value("${dlqurl}") String deadLetterQueueName) {
          return new SqsQueueHealthIndicator(amazonSQSAsync, deadLetterQueueName);
      }
  
  }
  </code></pre>