public abstract class ApplicationEventsHolder extends Object
ApplicationEvents object.
ApplicationEvents are registered in this holder and managed by
the ApplicationEventsTestExecutionListener.
Although this class is public, it is only intended for use within
the Spring TestContext Framework or in the implementation of
third-party extensions. Test authors should therefore allow the current
instance of ApplicationEvents to be
@Autowired
into a field in the test class or injected via a parameter in test and
lifecycle methods when using JUnit Jupiter and the SpringExtension.
ApplicationEvents,
RecordApplicationEvents,
ApplicationEventsTestExecutionListener| Modifier and Type | Method and Description |
|---|---|
static ApplicationEvents |
getApplicationEvents()
Get the
ApplicationEvents for the current thread. |
static ApplicationEvents |
getRequiredApplicationEvents()
Get the
ApplicationEvents for the current thread. |
@Nullable public static ApplicationEvents getApplicationEvents()
ApplicationEvents for the current thread.ApplicationEvents, or null if not registeredpublic static ApplicationEvents getRequiredApplicationEvents()
ApplicationEvents for the current thread.ApplicationEventsIllegalStateException - if an instance of ApplicationEvents
has not been registered for the current thread