title: SpringJUnit4ClassRunner does not close the Application Context at the end of JUnit test case
body: <p>I'm using SpringJUnit4ClassRunner in my JUnit 4 tests like this:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = {"classpath:/test-context.xml"})
  public class MyTest {
      @Autowired
      private ConfigurableApplicationContext context;
      @Test
      public void test1() {
      . . .
      }
      @Test
      public void test2() {
      . . .
      }
      . . .
  }
  </code></pre>
  
  <p>However, at the end of this test case the application context is not closed.
  I would like to have the application context closed at the end of the test case (NOT at the end of each individual unit-test in the test case).</p>
  
  <p>So far I could come up with this work-around:</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = {"classpath:/test-context.xml"})
  public class MyTest {
      @Autowired
      private ConfigurableApplicationContext context;
      private static ConfigurableApplicationContext lastContext;
      @After
      public void onTearDown() {
          lastContext = context;
      }
      @AfterClass
      public static void onClassTearDown() {
          lastContext.close();
      }
      @Test
      public void test1() {
      . . .
      }
      @Test
      public void test2() {
      . . .
      }
      . . .
  }
  </code></pre>
  
  <p>Is there a better solution?</p>