title: Springboot application cannot find application.yml from external folder (@PropertySource)
body: <p>I am trying to write a <strong>spring boot</strong> app (for <em>tomcat</em>), which has an <strong>application.yml</strong> file for configuration.</p>
  
  <p>My goal is to search for this yml file <strong>FIRST from the resources</strong>, and if it is not there, then <strong>SECONDLY from the tomcat's conf folder</strong>.</p>
  
  <p>My code, which is not working:</p>
  
  <pre><code>@SpringBootApplication
  @ComponentScan(basePackages = "com.my.app")
  @EnableConfigurationProperties
  @PropertySource(ignoreResourceNotFound=true,value={"classpath:application.yml","file:${catalina.base}/conf/application.yml"})
  public class MyApplication extends SpringBootServletInitializer {
  ...
  }
  </code></pre>
  
  <p>I want this, because if I work on my Eclipse, and want to <strong>use Tomcat server from Eclipse</strong>. In this case I want to use the resources folder. But if I build the war then I skip the yml file from it with the maven war plugin, and <strong>deploy it manually to Tomcat</strong>, I want to use the tomcat's folder.</p>
  
  <ul>
  <li>if I leave the yml file on the resources folder of the project, <strong>it works</strong></li>
  <li>if I delete the yml file from the resources, and place to the ${catalina.base}/conf folder (which is the embedded tomcat for eclipse, I know it), <strong>it doesn't work</strong></li>
  <li>if I delete the @PropertySource annotation, and leave the yml file in resources, <strong>it works</strong></li>
  </ul>
  
  <p><strong><em>So my app works only if the yml file on the resources folder, even if I add or remove the @PropertySource annotation.</em></strong></p>
  
  <p>How should I set to search for the resources folder for first time, and if there is no yml file, then search for the second option, which is the tomcat folder?</p>