Interface TestApplicationContextAware


public interface TestApplicationContextAware
Utility interface for test classes that require access to a shared ApplicationContext initialized via TestUtils.createTestApplicationContext().

This interface provides default @BeforeAll and @AfterAll lifecycle hooks to initialize and close the test application context once per test class.

It ensures that:

  • The context is refreshed exactly once before any test runs.
  • Any redundant refresh attempts are caught and suppressed (unless caused by an unrelated issue).
  • The context is properly closed after all tests complete.

To use this interface, a test class simply needs to implement it.

Since:
7.0
Author:
Glenn Renfro, Artem Bilan
  • Field Details

  • Method Details

    • beforeAll

      @BeforeAll static void beforeAll()
    • tearDown

      @AfterAll static void tearDown()