ApplicationRunListener class abstract
A listener for JetLeaf application lifecycle events during startup.
This abstract class can be implemented to hook into specific stages of the application's lifecycle such as environment preparation, context creation, and application readiness.
Implementations are often used to perform logging, initialize external services, configure context properties, or monitor startup performance.
Example
class LoggingRunListener implements ApplicationRunListener {
@override
void onStarting(ConfigurableBootstrapContext context) {
print("Application is starting...");
}
@override
void onReady(ConfigurableApplicationContext context, Duration timeTaken) {
print("Application ready in ${timeTaken.inMilliseconds}ms");
}
@override
void onFailed(ConfigurableApplicationContext? context, Object exception) {
print("Application failed to start: $exception");
}
}
Constructors
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onContextLoaded(
ConfigurableApplicationContext context) → FutureOr< void> - Called when the application context has loaded all configurations.
-
onContextPrepared(
ConfigurableApplicationContext context) → FutureOr< void> - Called after the application context has been created but not yet loaded.
-
onEnvironmentPrepared(
ConfigurableBootstrapContext context, ConfigurableEnvironment environment) → FutureOr< void> - Called once the application environment has been prepared.
-
onFailed(
ConfigurableApplicationContext? context, Object exception) → FutureOr< void> - Called if the application fails to start.
-
onReady(
ConfigurableApplicationContext context, Duration timeTaken) → FutureOr< void> - Called when the application is fully ready to service requests.
-
onStarted(
ConfigurableApplicationContext context, Duration timeTaken) → FutureOr< void> - Called after the application context has been refreshed and started.
-
onStarting(
ConfigurableBootstrapContext context, Class< Object> mainClass) → FutureOr<void> - Called immediately when the application starts.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited