ContextStoppedEvent class
Event published when the ApplicationContext is explicitly stopped.
This typically occurs when the context is paused without being closed or destroyed. For example, in a long-running application, the context might be stopped temporarily to conserve resources or halt scheduled tasks.
Listeners may use this event to perform cleanup, stop background processes, or safely pause services that should not run during the stopped state.
Example:
class ShutdownLogger implements ApplicationListener<ContextStoppedEvent> {
@override
void onApplicationEvent(ContextStoppedEvent event) {
print("Application context stopped: ${event.getSource()}");
}
}
The context can later be restarted by triggering a refresh or start event.
- Inheritance
-
- Object
- EventObject
- ApplicationEvent
- ApplicationContextEvent
- ContextStoppedEvent
Constructors
- ContextStoppedEvent(ApplicationContext source)
- Event published when the ApplicationContext is explicitly stopped.
- ContextStoppedEvent.withClock(ApplicationContext source, DateTime clock())
- Event published when the ApplicationContext is explicitly stopped.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
equalizedProperties(
) → List< Object?> -
Mixin-style contract for value-based equality,
hashCode
, andtoString
.inherited -
getApplicationContext(
) → ApplicationContext -
Returns the ApplicationContext that triggered this event.
inherited
-
getPackageName(
) → String - Represents an abstraction for identifying the package that an object, resource, or service belongs to.
-
getSource(
) → ApplicationContext -
Returns the ApplicationContext that published this event.
inherited
-
getTimestamp(
) → DateTime -
Returns the timestamp of the event.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
toStringOptions(
) → ToStringOptions -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited