title: Spring Boot 1.4 not loading application.properties after upgrade
body: <p>I am in process of upgrading a spring boot 1.3.3 project to 1.4.2.</p>
  
  <p>After upgrading the project Spring boot will no longer use any application.properties file. It does not locate it. Even when passed as an startup argument.</p>
  
  <p>The project is built with gradle and a <a href="https://github.com/johnrengelman/shadow" rel="nofollow noreferrer">shadowjar</a> plugin to compile to a fat jar and start tomcat embedded from the jar.</p>
  
  <p>The way the application is started is: java -jar app-all.jar. The directory containing the jar also contains the application.properties file. (and no other files)</p>
  
  <p>There is no classpath set and the jar file does not contain any other application.properties files. (Tested with unzip -t app-all.jar |grep application.properties)</p>
  
  <p>Starting the project under Spring Boot 1.3.3. The application starts correctly. Start of log file:</p>
  
  <pre>
  04:15:58.846 com.app.MaxApplication INFO  [main] - Starting MaxApplication on test-ng with PID 30096 (/home/ubuntu/app-all.jar started by ubuntu in /home/ubuntu)
  04:15:58.850 com.app.MaxApplication DEBUG [main] - Running with Spring Boot, Spring
  04:15:58.850 com.app.MaxApplication INFO  [main] - The following profiles are active: TEST
  04:15:58.850 org.springframework.boot.SpringApplication DEBUG [main] - Loading source class com.app.MaxApplication
  04:15:58.947 org.springframework.boot.context.config.ConfigFileApplicationListener DEBUG [main] - Activated profiles TEST
  04:15:58.947 org.springframework.boot.context.config.ConfigFileApplicationListener DEBUG [main] - Loaded config file 'file:./application.properties'
  </pre>
  
  <p>Changing spring boot version to 1.4.2, cleaning gradle caches and rebuilding and running the application the same way Spring Boot does nto load the applciation.properties file and the application fails to start due to missing configuration settings provided by the file. Start of log file:</p>
  
  <pre>
  01:48:47.547 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletConfigInitParams] PropertySource with lowest search precedence
  01:48:47.549 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletContextInitParams] PropertySource with lowest search precedence
  01:48:47.551 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
  01:48:47.552 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
  01:48:47.552 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,systemProperties,systemEnvironment]
  01:48:47.552 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.active' in any property source
  01:48:47.552 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.active' in any property source
  01:48:47.554 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'banner.image.location' in any property source
  01:48:47.555 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'banner.location' in any property source
  01:48:47.556 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'banner.charset' in any property source
  01:48:47.557 [main] DEBUG org.springframework.core.env.MutablePropertySources - Adding [version] PropertySource with lowest search precedence
  01:48:47.560 [main] DEBUG org.springframework.core.env.MutablePropertySources - Adding [ansi] PropertySource with highest search precedence
  01:48:47.561 [main] DEBUG org.springframework.core.env.MutablePropertySources - Adding [title] PropertySource with highest search precedence
  01:48:47.600 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletConfigInitParams] PropertySource with lowest search precedence
  01:48:47.600 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletContextInitParams] PropertySource with lowest search precedence
  01:48:47.600 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
  01:48:47.600 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
  01:48:47.601 [main] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,systemProperties,systemEnvironment]
  01:48:47.637 [main] DEBUG org.springframework.context.annotation.ClassPathBeanDefinitionScanner - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
  01:48:47.649 [main] INFO com.app.MaxApplication - Starting MaxApplication on test-ng (/home/ubuntu/app-all.jar started by ubuntu in /home/ubuntu)
  01:48:47.649 [main] DEBUG com.app.max.MaxApplication - Running with Spring Boot, Spring
  01:48:47.650 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.active' in any property source
  01:48:47.650 [main] DEBUG org.springframework.core.env.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.default' in any property source
  01:48:47.650 [main] INFO com.app.max.MaxApplication - No active profile set, falling back to default profiles: default
  01:48:47.650 [main] DEBUG org.springframework.boot.SpringApplication - Loading source class com.app.MaxApplication
  </pre>
  
  <p>Only two files in the current directory are the application.properties file and the jar file. The <a href="http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html" rel="nofollow noreferrer">externalizing configration documentation</a> says the configuration should be read from there. It also works under Spring 1.3.3</p>
  
  <p>I have defined a configuration class (this is working in 1.3)</p>
  
  <pre><code>@Component
  @Configuration
  @SpringBootConfiguration
  public class MaxApplicationProperties {
      @Bean
      public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
          return new PropertySourcesPlaceholderConfigurer();
      }
  }
  </code></pre>
  
  <p>I have tried:</p>
  
  <ul>
  <li>Adding application.properties file to the class path.</li>
  <li>Starting the application with --spring.config.location=application.properties (and with full path as well)</li>
  <li>Setting config location environment variables.</li>
  <li>Adding annotation @PropertySource("classpath:application.properties") to the MaxApplicationProperties class</li>
  <li>Force deleting all downloaded libraries and having gradle re-download everything.</li>
  </ul>
  
  <p>None of these options work to make Spring boot attempt to use the application.properties file the same was as Spring boot 1.3.</p>
  
  <p>Anyone know what I am missing? Thanks.</p>