title: Application context is coming as null while running spring integration test with @ContextConfiguration
body: <p>I am trying to write integration test with spring. Below is the test class </p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations={"classpath*:**/context*.xml"})
  public class MyFirstTestClass {
  
        @AutoWired
        private ApplicationContext applicationContext;
  
        @Test
        public void testApplicationContext {
          applicationContext.getName();
        }    
  }
  </code></pre>
  
  <p>When I run the test from maven I am getting <code>NullPointerException</code> because <code>applicationContext</code> is <code>null</code>. I am not able to understand the reason. Also in logs also i don't see any error. I tried putting configuration <code>&lt;context:annotation-config/&gt;</code> in one of the application context files. Still I am getting same error.</p>
  
  <p>When i use classpath*:**/context*.xml to create context manually it works. But i believe when i use context configuraton its not loading the application context file.I am not getting any error as well.
  Kindly suggest</p>
  
  <hr>
  
  <p>Okay i managed to load the application context . but now the iam getting <code>NoSuchBeanDefinition</code> exception.</p>
  
  <p>bean file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.springframework.org/schema/beans 
                             http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
  
      &lt;bean id="messageService"
            class="com.mycompany.app.MessageService"&gt;
      &lt;/bean&gt;    
  &lt;/beans&gt;                 
  </code></pre>
  
  <p>Test class </p>
  
  <pre><code>package com.mycompany.app;
  import org.junit.runner.RunWith;
  import static org.junit.Assert.*;
  import org.junit.Test;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.beans.factory.annotation.Configurable;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  import org.springframework.test.context.ContextConfiguration;
  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  import junit.framework.TestSuite;
  @ContextConfiguration(locations={"classpath*:*/AppTest.context.xml"})
  @RunWith(SpringJUnit4ClassRunner.class)
  public class AppTest 
  {
      @Autowired
      private ApplicationContext applicationContext;
  
  
      public AppTest(  )
      {
  
      }
  
      @Test
      public void testApp(){
  
          assertNotNull(applicationContext);
          for(String str : applicationContext.getBeanDefinitionNames()){
              System.out.println("Bean feifniaio count"+str); 
          }
          applicationContext.getBean("messageService");
      }
  }
  </code></pre>
  
  <p>Log after execution of test</p>
  
  <blockquote>
    <p>INFO: Refreshing
    org.springframework.context.support.GenericApplicationContext@196751b:
    startup date [Fri Nov 20 00:00:11 IST 2015]; root of context hierarchy
    Bean feifniaio
    countorg.springframework.context.annotation.internalConfigurationAnnotationProcessor
    Bean feifniaio
    countorg.springframework.context.annotation.internalAutowiredAnnotationProcessor
    Bean feifniaio
    countorg.springframework.context.annotation.internalRequiredAnnotationProcessor
    Bean feifniaio
    countorg.springframework.context.annotation.internalCommonAnnotationProcessor
    Bean feifniaio
    countorg.springframework.context.event.internalEventListenerProcessor
    Bean feifniaio
    countorg.springframework.context.event.internalEventListenerFactory
    Bean feifniaio
    countorg.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor
    Bean feifniaio
    countorg.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor</p>
  </blockquote>
  
  <p>I am not able to see message service bean. What could be the issue??</p>