# ContextFailedEvent.withClock constructor

ContextFailedEvent.withClock(

1. ApplicationContext source,
2. DateTime clock()

)

Event published when the ApplicationContext fails to start or refresh.

This typically occurs when the context fails to start or refresh. For example, in a long-running application, the context might fail to start or refresh.

Listeners may use this event to perform cleanup, stop background processes, or safely pause services that should not run during the failed state.

### Example:

    class ShutdownLogger implements ApplicationListener<ContextFailedEvent> {
      @override
      void onApplicationEvent(ContextFailedEvent event) {
        print("Application context failed: ${event.getSource()}");
      }
    }

The context can later be restarted by triggering a refresh or start event.

## Implementation

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