ContextStartedEvent.withClock constructor

ContextStartedEvent.withClock(
  1. ApplicationContext source,
  2. DateTime clock()
)

Event published when the ApplicationContext is started or restarted.

This event indicates that the context is now active and ready to process requests, initialize pods, or resume tasks that may have been paused or stopped.

It is typically used after a call to start() or when a previously stopped context is reactivated.


Example:

class StartupLogger implements ApplicationListener<ContextStartedEvent> {
  @override
  void onApplicationEvent(ContextStartedEvent event) {
    print("Application context started: ${event.getSource()}");
  }
}

Implementation

ContextStartedEvent.withClock(ApplicationContext source, DateTime Function() clock) : super.withClock(source, clock);