ContextClosedEvent constructor
ContextClosedEvent(
- ApplicationContext source
Event published when an ApplicationContext is closed.
This indicates that the application context is shutting down, and all managed pods should release resources, stop background tasks, or perform any necessary cleanup before termination.
This event is typically fired at the end of the application lifecycle, right before the context is destroyed.
Example:
class MyShutdownListener implements ApplicationListener<ContextClosedEvent> {
@override
void onApplicationEvent(ContextClosedEvent event) {
print("Shutting down context: ${event.getSource()}");
}
}
Registered ApplicationEventListeners can listen for this event to trigger disposal or teardown logic.
Implementation
ContextClosedEvent(super.source);