title: Spring integration test with context hierarchy child context bean as application listener
body: <p>I am new to Spring, forgive me if I am doing something silly. I am trying to write an integration test for my application which uses spring.</p>
  
  <p>I am creating a context hierarchy, as follows</p>
  
  <pre><code>  @Before
    public void setup(){
       parentContext = new AnnotationConfigApplicationContext(TestConfig.class);
       // some more setup stuff here
    }
  </code></pre>
  
  <p>In my test method, I am trying to create a new child context that has just one bean which is an application listener, that depends on beans in parent method.</p>
  
  <pre><code>public void test(){
      childContext = new AnnotationConfigApplicationContext();
      childContext.setParent(ctx);
      register(TestConfig2.class);
      childContext.refresh();
      // some testing stuff here that generates events
  }
  </code></pre>
  
  <p>The problem I am facing is that my bean from the child context is not getting notified on application events also my @Value annotations are not processed.</p>
  
  <p>what am I doing wrong here?</p>