title: Start JUnit test with fresh Spring Context
body: <p>I wrote two unit test classes using <code>JUnit4</code>. They both run fine separately, but running them one after another (by for example mvn test), the second test fails.</p>
  
  <p>The reason the second test fails is because the first test modified a bean in the first test. The second test wants to use a fresh instance of this bean.</p>
  
  <p>A unit test should be given a new Context for each unit test class. Spring has first-class support for context caching which I would like to disable. How can I configure <code>Spring</code> to restart a new <code>Context</code> for each unit test class?</p>
  
  <p>My test classes are configured as such:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = "classpath:a.context.xml")
  public class AUnitTest {
  
    @Test
    public void someTestMethod{
      doSomeFancyStuff();
    }
  }
  </code></pre>