ApplicationFailedEvent class

Published when the start fails or a runner throws, before the failure is reported and the context is closed.

Use it to tell someone that the application did not start, for example to send an alert or to flush a log. When the failure happens while the beans are created there are no beans to receive it, so only listeners registered on the SpringApplication (and those of the failed context) see it. When a runner fails, it goes through the running context, and @EventListener methods receive it too. A listener that throws is logged and does not hide the original failure.

springApplication.addListener<ApplicationFailedEvent>(
  (event) => alerts.send('checkout did not start: ${event.exception}'),
);

Spring (Java): ApplicationFailedEvent.

Inheritance

Constructors

ApplicationFailedEvent(SpringApplication application, List<String> args, ConfigurableApplicationContext? applicationContext, Object exception)
The event for application run with args, carrying exception and, when one was created, applicationContext; published by SpringApplication.

Properties

applicationContext → ConfigurableApplicationContext?
The context, or null when the start failed before it was created (while reading the configuration, for example).
final
args → List<String>
The arguments of the run, as main received them.
finalinherited
exception → Object
The error that stopped the start, as it is rethrown afterwards.
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
springApplication → SpringApplication
The application being started; the same object as source, with its type.
no setterinherited
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