title: Spring Boot external properties file (with profiles)?
body: <p>What I am trying to accomplish, is to specify a directory on my application.yml file located directly on the classpath (under /resources). I would like to be able to have something like:</p>
  
  <pre><code> spring:     
    datasource:
      driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
    profiles:
      active: dev
    config:
      location: C:\\app\\configs\\
  </code></pre>
  
  <p>Then under the c:\settings\configs\ location, I would like to have multiple config files based on the profile being loaded, such as:</p>
  
  <pre><code>c:\app\configs:
  application-dev.yml
  application-staging.yml
  application-production.yml
  </code></pre>
  
  <p>Using this approach, the IDE would always default to application-dev.yml. When I build the app via gradle, and run it while passing in the command line arguments, I can specify the profile, thus loading the appropriate file. Ideally, being able to do just this:</p>
  
  <blockquote>
    <p>java -jar -Dspring.profiles.active=staging appliation.jar</p>
  </blockquote>
  
  <p>All the examples or answers I've seen have shown how to pass this all these config options from the command line only, not using </p>
  
  <blockquote>
    <p>spring.config.location</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>spring.profiles.active</p>
  </blockquote>
  
  <p>from within a default config file (eg: application.yml). Preference is to set this up as described above for minimal deployment.</p>
  
  <p>Thank you for any suggestions / help!</p>