title: Clear Spring application context after test
body: <p>How can I clear the application context after each test execution, with Junit5 and Spring Boot? I want all beans created in the test to be destroyed after its execution, since I am creating the same beans in multiple tests. I don't want to have one configuration class for all tests, but configuration class per test, as shown bellow.   </p>
  
  <pre><code>@ExtendWith(SpringExtension.class)
  @ContextConfiguration(classes = MyTest.ContextConfiguration.class)
  public class MyTest{
     ...
     public static class ContextConfiguration {
       // beans defined here... 
  
     }
  }
  </code></pre>
  
  <p>Putting <code>@DirtiesContext(classMode = BEFORE_CLASS)</code> doesn't work with Junit5.</p>