title: spring boot specific profile yaml not loading
body: <p>I have a yaml file as follows:-</p>
  
  <pre><code>spring:
    profiles: test
  msg: test
  ---
  spring:
    profiles : dev
  msg: hello
  ---
  spring:
    profiles : prod
  msg: production
  </code></pre>
  
  <p>located in <code>/src/main/java/resources</code> as <code>application.yaml</code></p>
  
  <p>my code the read the values from this file is as follows</p>
  
  <pre><code>@Configuration
  @EnableConfigurationProperties
  public class TestConfig {
  
      private String msg;
  
      public String getMsg() {
          return msg;
      }
  
      public void setMsg(String msg) {
          this.msg = msg;
      }
  }
  </code></pre>
  
  <p>I create a bean of this class as following:-</p>
  
  <pre><code>@Bean
  public TestConfig testConfig() {
      return new TestConfig();
  }
  </code></pre>
  
  <p>But trying to see the profile specific information does not work with the following code:-</p>
  
  <pre><code>public class Main implements CommandLineRunner{
  
      @Autowired
      private TestConfig testConfig;
  
      public static void main(String[] args) {
  
          SpringApplication.run(Main.class, args);
  
      }
  
      @Override
      public void run(String... args) throws Exception {
          System.out.println("it works!!!");
          System.out.println("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;   " + testConfig.getMsg());
      }
  }
  </code></pre>
  
  <p>Any help here is much appreciated.</p>
  
  <p>Thanks,
  Amar</p>