title: Spring JUnit Test not loading full Application Context
body: <p>Hi I am trying to so spring junit test cases... and I require my full application context to be loaded. However the junit test does not initialize the full application context.</p>
  
  <p>Test class:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @SpringApplicationConfiguration(classes = Application.class)
  public class MongoDbRepositoryTest {
  
      @Value("${spring.datasource.url}")
      private String databaseUrl;
  
      @Inject
      private ApplicationContext appContext;
  
      @Test
      public void testCRUD() {
          System.out.println("spring.datasource.url:" + databaseUrl);
          showBeansIntialised();
          assertEquals(1, 1);
      }
  
      private void showBeansIntialised() {
          System.out.println("BEEEAAANSSSS");
          for (String beanName : appContext.getBeanDefinitionNames()) {
              System.out.println(beanName);
          }
      }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>spring.datasource.url:${spring.datasource.url}
  BEEEAAANSSSS
  org.springframework.context.annotation.internalConfigurationAnnotationProcessor
  org.springframework.context.annotation.internalAutowiredAnnotationProcessor
  org.springframework.context.annotation.internalRequiredAnnotationProcessor
  org.springframework.context.annotation.internalCommonAnnotationProcessor
  org.springframework.context.annotation.internalPersistenceAnnotationProcessor
  org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor
  org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor
  </code></pre>
  
  <p>Main Application Class Annotations:</p>
  
  <pre><code>@ComponentScan(basePackages = "com.test")
  @EnableAutoConfiguration(exclude = { MetricFilterAutoConfiguration.class, MetricRepositoryAutoConfiguration.class })
  @EnableMongoRepositories("com.test.repository.mongodb")
  @EnableJpaRepositories("com.test.repository.jpa")
  @Profile(Constants.SPRING_PROFILE_DEVELOPMENT)
  public class Application { ...
  </code></pre>
  
  <p>Hence it should scan all the spring bean in the package com.test and also load them into the applicationcontext for the Junit testcase. But from the output of the beans initalised it doesnt seem to be doing this.</p>