title: Spring Boot 2.1 : Not loading property from application-test.yml
body: <p>I am trying to read a property from application-test.yml during my unit test execution, but instead, the property from application-dev.yml is being read instead. I do not have a application.yml file. Appreciate the help.</p>
  
  <p><strong>AppProperties.java</strong></p>
  
  <pre><code>@Component
  @ConfigurationProperties(prefix="app")
  public class AppProperties {
  
      private String test;    
  
      public String getTest() {
          return this.test;
      }
  
      public void setTest(String test) {
          this.test = test;
      }
  }
  </code></pre>
  
  <p><strong>application-dev.yml</strong></p>
  
  <pre><code>spring:
    profiles: dev
    application:
      name: testApplication
  app:
    test: 1
  </code></pre>
  
  <p><strong>application-test.yml</strong></p>
  
  <pre><code>spring:
    profiles: test
    application:
      name: testApplication
  app:
    test: 2
  </code></pre>
  
  <p><strong>AppServiceTest.java</strong></p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @ContextConfiguration(classes = {AppProperties.class}, initializers= ConfigFileApplicationContextInitializer.class)
  @EnableConfigurationProperties
  @ActiveProfiles("test")
  public class AppServiceTest{
  
  @Autowired
  AppProperties appProperties;
  
  @Test
  public void test(){    
      appProperties.getTest();  
      //This returns "1" instead of the desired "2"
  }
  </code></pre>