title: Spring Boot not recognizing application.properties file
body: <p>I'm trying to configure a DynamoDb client with Spring Boot, and placed my endpoints and configuration information in my resources/application.properties file. However, Spring Boot does not seem to pick up these properties. It does pick up the "server.default" key that I have stored in the same file, so it is definitely recognizing the  the file itself. </p>
  
  <p>Here is my application.properties file and the class I'm trying to load properties into (<strong>DynamoDBClientMapper</strong>):</p>
  
  <pre><code>amazon.dynamodb.endpoint=http://localhost:8000/
  amazon.dynamodb.region=us-west-1
  amazon.aws.accesskey=key
  amazon.aws.secretkey=key2
  
  server.port=8080
  </code></pre>
  
  <p>Here is my project structure:
  <a href="https://i.stack.imgur.com/78wGZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/78wGZ.png" alt="enter image description here"></a></p>
  
  <p>Here is the relevant class I'm trying to load properties into. I tried the <strong>@PropertySource</strong> annotation with a new properties file, as well as <strong>EnableAutoConfiguration</strong>, but neither are registering the properties file(s).</p>
  
  <pre><code>@PropertySource("database.properties")
  public class DynamoClientMapper {
  
      @Value("${amazon.dynamodb.endpoint}")
      private String amazonDynamoDBEndpoint;
  
      @Value("${amazon.aws.accesskey}")
      private String amazonAWSAccessKey;
  
      @Value("${amazon.aws.secretkey}")
      private String amazonAWSSecretKey;
  
      @Value("${amazon.aws.region}")
      private String amazonAWSRegion;
  </code></pre>
  
  <p>Here is my App.java:</p>
  
  <pre><code>@SpringBootApplication
  @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
  public class App {
  
  //    private static final Logger logger = Logger.getLogger(App.class.toString());
  
      public static void main(String[] args){
          SpringApplication.run(App.class, args);
      }
  }
  </code></pre>
  
  <p>Here is the stack trace:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamoClientMapper' defined in file [C:\Users\ychen4\Desktop\DiningApplication\target\classes\main\java\com\dining\dao\DynamoClientMapper.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [main.java.com.dining.dao.DynamoClientMapper$$EnhancerBySpringCGLIB$$f4ba10ad]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: endpoint cannot be null
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1155) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
      at main.java.com.dining.App.main(App.java:18) [classes/:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
      at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.2.RELEASE.jar:1.5.2.RELEASE]
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [main.java.com.dining.dao.DynamoClientMapper$$EnhancerBySpringCGLIB$$f4ba10ad]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: endpoint cannot be null
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1147) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      ... 22 common frames omitted
  Caused by: java.lang.IllegalArgumentException: endpoint cannot be null
      at com.amazonaws.util.RuntimeHttpUtils.toUri(RuntimeHttpUtils.java:182) ~[aws-java-sdk-core-1.11.125.jar:na]
      at com.amazonaws.util.RuntimeHttpUtils.toUri(RuntimeHttpUtils.java:171) ~[aws-java-sdk-core-1.11.125.jar:na]
      at com.amazonaws.AmazonWebServiceClient.toURI(AmazonWebServiceClient.java:238) ~[aws-java-sdk-core-1.11.125.jar:na]
      at com.amazonaws.AmazonWebServiceClient.setEndpoint(AmazonWebServiceClient.java:228) ~[aws-java-sdk-core-1.11.125.jar:na]
      at com.amazonaws.client.builder.AwsClientBuilder.setRegion(AwsClientBuilder.java:362) ~[aws-java-sdk-core-1.11.125.jar:na]
      at com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(AwsClientBuilder.java:337) ~[aws-java-sdk-core-1.11.125.jar:na]
      at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46) ~[aws-java-sdk-core-1.11.125.jar:na]
      at main.java.com.dining.dao.DynamoClientMapper.&lt;init&gt;(DynamoClientMapper.java:32) ~[classes/:na]
      at main.java.com.dining.dao.DynamoClientMapper$$EnhancerBySpringCGLIB$$f4ba10ad.&lt;init&gt;(&lt;generated&gt;) ~[classes/:na]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_121]
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_121]
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_121]
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_121]
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
      ... 24 common frames omitted
  </code></pre>
  
  <p>I've tried making another separate database.properties file , but Spring Boot isn't recognizing that either. What am I doing wrong?</p>