title: Default @ContextConfiguration working but not when manually set
body: <p>I have an Application Configuration class</p>
  
  <pre><code>@Configuration
  @EnableScheduling
  public class AppConfig {
  
      @Bean
      public HibernateJpaSessionFactoryBean sessionFactory() {
          return new HibernateJpaSessionFactoryBean();
      }
  }
  </code></pre>
  
  <p>And I am running a test as </p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @SpringBootTest
  @TestPropertySource(locations="classpath:test.properties")
  public class CollectiveOneWebappApplicationTests {
  
      @Test
      public void testDecisionAlgorithm() throws IOException {
      ...
      }
  </code></pre>
  
  <p>It works fine. Now I want to change the configuartion class for the test, so I created</p>
  
  <pre><code>public class TestConfig {
  
      @Bean
      public HibernateJpaSessionFactoryBean sessionFactory() {
          return new HibernateJpaSessionFactoryBean();
      }
  }
  </code></pre>
  
  <p>And updated the test to</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @SpringBootTest
  @TestPropertySource(locations="classpath:test.properties")
  @ContextConfiguration(classes = TestConfig.class)
  public class CollectiveOneWebappApplicationTests {
  
      @Test
      public void testDecisionAlgorithm() throws IOException {
      ...
      }
  </code></pre>
  
  <p>But it doesn't work. Its unable to find the bean of Hibernate entity factory</p>
  
  <pre><code>org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] 
  </code></pre>
  
  <p>I tought for a moment, that using</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @SpringBootTest
  @TestPropertySource(locations="classpath:test.properties")
  @ContextConfiguration(classes = AppConfig.class)
  public class CollectiveOneWebappApplicationTests {
  
      @Test
      public void testDecisionAlgorithm() throws IOException {
      ...
      }
  </code></pre>
  
  <p>would bring me back to the default behavior, but it doesn't. Any idea on why <code>@ContextConfiguration(classes = AppConfig.class)</code> is different from no annotation at all?</p>