Example usage for org.springframework.context.event ContextStartedEvent getApplicationContext

List of usage examples for org.springframework.context.event ContextStartedEvent getApplicationContext

Introduction

In this page you can find the example usage for org.springframework.context.event ContextStartedEvent getApplicationContext.

Prototype

public final ApplicationContext getApplicationContext() 

Source Link

Document

Get the ApplicationContext that the event was raised for.

Usage

From source file:natalia.dymnikova.cluster.AutostartActorsBeanPostProcessor.java

@EventListener(ContextStartedEvent.class)
public void onStart(final ContextStartedEvent event) {
    if (event.getApplicationContext() == applicationContext) {
        final long start = nanoTime();
        try {//w w  w.  jav  a 2  s. c  om
            startActors();
        } finally {
            log.warn("Autostart actors started in {} sec", ofNanos(nanoTime() - start).getSeconds());
        }
    }
}