OnApplicationReady class final

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 or Duration.
  • Two-Args: The method should accept two arguments of types ConfigurableApplicationContext and Duration.

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!");
  }
}
Annotations
  • @Target.new({TargetKind.method})

Constructors

OnApplicationReady()
Annotation to mark a method that should run when the application is fully ready to serve requests.
const

Properties

annotationType Type
Returns the annotation _type of this annotation.
no setter
hashCode int
Returns a hash code consistent with equality definition.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

equals(Object other) bool
Checks whether the given object is logically equivalent to this annotation.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a string representation of this annotation.
inherited

Operators

operator ==(Object other) bool
Checks if this annotation is equal to another object.
inherited