title: Spring Boot, Spring Cloud AWS and AWS SQS not reading from the queue
body: <p>I am trying a to build a minimal gradle java project with Spring Boot and Spring Cloud AWS SQS but I can't get it to read from the queue.</p>
  
  <p>These are my project files:</p>
  
  <p>build.gradle:</p>
  
  <pre><code>apply plugin: "java"
  apply plugin: "eclipse"
  apply plugin: "spring-boot"
  apply plugin: "io.spring.dependency-management"
  
  sourceCompatibility = 1.8
  targetCompatibility = 1.8
  
  buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE")
          classpath("io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE")
      }
  }
  
  dependencyManagement {
       imports {
            mavenBom("org.springframework.cloud:spring-cloud-aws:1.1.0.RELEASE")
       }
  }
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile("org.springframework.boot:spring-boot-starter-actuator:1.3.5.RELEASE")
      compile("org.springframework.cloud:spring-cloud-starter-aws:1.1.0.RELEASE")
      // if I don't add the line below, the annotation @MessageMapping is not found :(
      // I would have expected that cloud-starter-aws would have taken care of it
      compile("org.springframework.cloud:spring-cloud-aws-messaging:1.1.0.RELEASE")
      // this has been added to fix an exception happening, please read below
      compile("org.springframework.data:spring-data-commons:1.12.1.RELEASE")
  }
  </code></pre>
  
  <p>Application.java:</p>
  
  <pre><code>package com.test;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class Application
  {    
      public static void main(String[] args)
      {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p>QueueListener.java:</p>
  
  <pre><code>package com.test.sqs;
  
  import java.util.logging.Logger;
  import org.springframework.messaging.handler.annotation.MessageMapping;
  import com.test.sqs.model.TestMessage;
  
  public class QueueListener
  {
      @MessageMapping("test_queue")
      private void receiveMessage(TestMessage testMessage)
      {
          System.out.println("Test message received: " + testMessage.getMessage());
      }
  }
  </code></pre>
  
  <p>application.yaml in src/main/resources:</p>
  
  <pre><code>cloud:
      aws:
          credentials:
              accessKey: **********************
              secretKey: **********************
          region:
              static: us-west-2
  </code></pre>
  
  <p>The application throws an exception when starting (but you can see the exception just in log debug mode!):</p>
  
  <pre><code>org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.auth.profile.ProfilesConfigFile]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: AWS credential profiles file not found in the given path: C:\src\collector\default
  </code></pre>
  
  <p>but always in the log I can see it did pick up my credentials from the yaml file:</p>
  
  <pre><code>2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'cloud.aws.credentials.accessKey' in [systemProperties]
  2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'cloud.aws.credentials.accessKey' in [systemEnvironment]
  2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'cloud.aws.credentials.accessKey' in [random]
  2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'cloud.aws.credentials.accessKey' in [applicationConfigurationProperties]
  2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'cloud.aws.credentials.accessKey' in [applicationConfigurationProperties] with type [String] and value '***'
  2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'cloud.aws.credentials.secretKey' in [systemProperties]
  2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'cloud.aws.credentials.secretKey' in [systemEnvironment]
  2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'cloud.aws.credentials.secretKey' in [random]
  2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'cloud.aws.credentials.secretKey' in [applicationConfigurationProperties]
  2016-05-19 11:15:14.546 DEBUG 11704 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'cloud.aws.credentials.secretKey' in [applicationConfigurationProperties] with type [String] and value '***'
  </code></pre>
  
  <p>So I am not sure why it is looking somewhere else?</p>
  
  <p>Also it's throwing this exception (always visible just if you are in logging debug mode):</p>
  
  <pre><code>    java.lang.ClassNotFoundException: org.springframework.data.web.config.EnableSpringDataWebSupport
  </code></pre>
  
  <p>So I had to add in build.gradle</p>
  
  <pre><code>compile("org.springframework.data:spring-data-commons:1.12.1.RELEASE")
  </code></pre>
  
  <p>But now the exception is not there anymore but the program starts and ends without doing anything, and it's not printing logs anymore!</p>
  
  <p>Some other facts:</p>
  
  <ul>
  <li>the Application.java is in the right package to let the component scan to work, so Spring should see the QueueListener class, </li>
  <li>the application.yaml is read correctly, if a put a wrong region it complains,</li>
  <li>if I put wrong credentials (wrong accessKey or/and wrong secretKey) it does not complain, so I don't think it is trying to connect to AWS at all.</li>
  </ul>
  
  <p>I am not sure if line 34 of build.gradle:</p>
  
  <pre><code>compile("org.springframework.cloud:spring-cloud-starter-aws:1.1.0.RELEASE")
  // if I don't add the line below, the annotation @MessageMapping is not found :(
  // I would have expected that cloud-starter-aws would have taken care of it
  compile("org.springframework.cloud:spring-cloud-aws-messaging:1.1.0.RELEASE")
  // this has been added to fix an exception happening, please read below
  compile("org.springframework.data:spring-data-commons:1.12.1.RELEASE")
  </code></pre>
  
  <p>could be a symptom of the issue, I would expect for all the needed libraries to be loaded by the cloud-starter-aws automatically.</p>
  
  <p>What am I missing? Thank you!</p>