OnApplicationReady constructor
const
OnApplicationReady()
Annotation to mark a method that should run when the application is fully ready to serve requests.
Use this to start background tasks, open connections, or notify external systems that the application is live.
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
ConfigurableApplicationContext
orDuration
. - Two-Args: The method should accept two arguments of types
ConfigurableApplicationContext
andDuration
.
Example
class MyApp {
@OnApplicationReady()
void notifyReady() {
print("Application is fully ready!");
}
@OnApplicationReady()
void notifyReadyWithContext(ConfigurableApplicationContext context) {
print("Application is fully ready!");
}
@OnApplicationReady()
void notifyReadyWithContextAndTime(ConfigurableApplicationContext context, Duration timeTaken) {
print("Application is fully ready!");
}
@OnApplicationReady()
void notifyReadyWithTime(Duration timeTaken) {
print("Application is fully ready!");
}
}
Implementation
const OnApplicationReady();