title: SpringBoot custom spring.config.location
body: <p>I have a simple SpringBoot application with the following structure:</p>
  
  <p><a href="https://i.stack.imgur.com/na4ln.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/na4ln.png" alt="enter image description here"></a></p>
  
  <p>I'm using a standard application.yml file where I'm storing all the necessary props and use @ConfigurationProperties annotation to inject them where necessary.</p>
  
  <p>Now for one bean I have quite a lot of props and I don't want to overwhelm my common application.yml file with all that props. So I want a separate one (which I placed under service dir in classpath).</p>
  
  <p>According to Spring docs I can use something like:</p>
  
  <pre><code>java -jar myproject.jar --spring.config.location=classpath:/service/application.yml
  </code></pre>
  
  <p>But that's not working, I got NullPointer which means property was not injected.
  What Am I doing wrong? How can I use another *.yml file together with application.yml?</p>
  
  <p>P.S. I know I could place it under the config folder in classpath, but what if I need two custom files?</p>