title: Spring test @ContextConfiguration and static context
body: <p>I have the following piece of code for my abstract test class (I know <code>XmlBeanFactory</code> with <code>ClassPathResource</code> is deprecated, but it's unlikely to be the case of the problem).</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration
  public abstract class AbstractIntegrationTest {
  
      /** Spring context. */
      protected static final BeanFactory context = new XmlBeanFactory(new ClassPathResource(
              "com/.../AbstractIntegrationTest-context.xml"));
  
      ...
  
  }
  </code></pre>
  
  <p>It loads the default test configuration XML file <code>AbstractIntegrationTest-context.xml</code> (and then I use autowiring). I also need to use Spring in static methods annotated with <code>@BeforeClass</code> and <code>@AfterClass</code>, so I have a separate context variable pointing to the same location. But the thing is that this is a separate context, which will have different instances of beans. So how can I merge these contexts or how can I invoke Spring's bean initialization defined by <code>@ContextConfiguration</code> from my static context?</p>
  
  <p>I have in mind a possible solution by getting rid of those static members, but I'm curious, if I can do it with relatively small changes to the code.</p>