ContextFailedEvent constructor

ContextFailedEvent(
  1. ApplicationContext source
)

Event published when the ApplicationContext fails to start or refresh.

This typically occurs when the context fails to start or refresh. For example, in a long-running application, the context might fail to start or refresh.

Listeners may use this event to perform cleanup, stop background processes, or safely pause services that should not run during the failed state.


Example:

class ShutdownLogger implements ApplicationListener<ContextFailedEvent> {
  @override
  void onApplicationEvent(ContextFailedEvent event) {
    print("Application context failed: ${event.getSource()}");
  }
}

The context can later be restarted by triggering a refresh or start event.

Implementation

ContextFailedEvent(super.source);