ContextFailedEvent class

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.

Inheritance

Constructors

ContextFailedEvent(ApplicationContext source)
Event published when the ApplicationContext fails to start or refresh.
ContextFailedEvent.withClock(ApplicationContext source, DateTime clock())
Event published when the ApplicationContext fails to start or refresh.

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, and toString.
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