ExitCodeEvent class

Announces that the application is about to end with a non-zero exit code.

SpringApplication.exit publishes it before closing the context, and so does a failed runner whose error was given a code. A bean can listen to it to record why the program ended, while the other beans are still available. A code of 0 is never published.

@Component()
@Log()
class ExitAudit {
  @EventListener()
  void onExit(ExitCodeEvent event) =>
      log.info('ending with exit code ${event.exitCode}');
}

Spring (Java): ExitCodeEvent.

Inheritance

Constructors

ExitCodeEvent(Object source, int exitCode)
The event for exitCode; source is the application's context.

Properties

exitCode → int
The exit code the application ends with; never 0.
final
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