ApplicationContextEvent class abstract

The base class of the events a context publishes about itself: refreshed, started, stopped, paused, restarted, closed.

Applications receive these events; they never create them. Listen to this base class to react to all of them, or to one subclass for one moment of the context's life. Events published in a child context reach the parent's listeners too; compare applicationContext when that matters.

// Logs every state change of every context.
@Component()
@Log()
class ContextLog {
  @EventListener()
  void on(ApplicationContextEvent event) =>
      log.info('${event.runtimeType} of ${event.applicationContext.id}');
}

Spring (Java):

@EventListener
void on(ApplicationContextEvent event) { ... }
Inheritance

Constructors

ApplicationContextEvent(ApplicationContext source)
Creates an event raised by the context source; contexts do this.

Properties

applicationContext → ApplicationContext
The context that raised the event (the same object as source, typed).
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
source → Object
The object that raised the event, usually the publishing bean (or the context, for the context's own events).
finalinherited
timestamp → DateTime
When the event was created (not when a listener receives it).
finalinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited