OnApplicationFailed constructor
const
OnApplicationFailed()
Annotation to mark a method that should run when the application fails to start or refresh.
This is typically used to log errors, notify monitoring systems, or attempt recovery steps.
The only acceptable method signatures are:
- No-Arg: The method should not accept any arguments.
- One-Arg: The method should accept a single argument of type
Object
which will be an exception or optionalConfigurableApplicationContext
. - Two-Args: The method should accept two arguments of types
Object
which will be an exception and optionalConfigurableApplicationContext
.
Example
class MyApp {
@OnApplicationFailed()
void handleFailure() {
print("Application failed to start!");
}
@OnApplicationFailed()
void handleFailureWithContext(ConfigurableApplicationContext? context) {
print("Application failed to start!");
}
@OnApplicationFailed()
void handleFailureWithContextAndException(ConfigurableApplicationContext? context, Object exception) {
print("Application failed to start!");
}
@OnApplicationFailed()
void handleFailureWithException(Object exception) {
print("Application failed to start!");
}
}
Implementation
const OnApplicationFailed();