Spring Boot - Loading a .properties file from WEB-INF/ folder
<p>I have a Spring Boot 1.3 application (deployed as .war) that needs to be able read a <code>.properties</code> file from the following location:</p>

<p><code>WEB-INF/application.properties</code> (outside the classpath, but relative to the app root folder)</p>

<p>...as opposed to:</p>

<p><code>WEB-INF/classes/application.properties</code>(inside the classpath, gets loaded automatically)</p>

<p>What worked in Spring Boot 1.3 was the following <code>@PropertySource</code> annotation:</p>

<pre><code>@SpringBootApplication
@PropertySource(value = {"WEB-INF/application.properties"})
public class MyApplication {
        public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }
}
</code></pre>

<p>It correctly fetched the <code>.properties</code> file relative to the app root. However that stops working after an update to Spring Boot 1.4.0.RC1.</p>

<p>Since then I've tried the following:</p>

<pre><code>@PropertySource("classpath:../application.properties")
@PropertySource("file:WEB-INF/application.properties")
</code></pre>

<p>and also</p>

<pre><code>spring.config.location=classpath:../
spring.config.location=file:src/main/webapp/WEB-INF/
spring.config.location=WEB-INF/application.properties
</code></pre>

<p>But haven't had any luck loading the .properties.</p>

<p>I'd normally put the <code>.properties</code> file inside the classpath, but in this case this is NOT an option due to the way our deployment works on a remote location. </p>

<p>I'd also prefer to not use an absolute path, as that'll be a nightmare to support with multiple customers. </p>

<p>Edit: Just to be clear - the <code>.properties</code> I'd like to read aren't located outside the JAR (in my case - WAR) file, but inside - just not on the classpath, but directly in the <code>WEB-INF/</code> folder where normally other resources (pages, images) would be.</p>