Search in sources :

Example 1 with ApplicationStartupEvent

use of io.micronaut.runtime.event.ApplicationStartupEvent in project micronaut-core by micronaut-projects.

the class MessagingApplication method start.

@Override
public MessagingApplication start() {
    ApplicationContext applicationContext = getApplicationContext();
    if (applicationContext != null && !applicationContext.isRunning()) {
        try {
            applicationContext.start();
            applicationContext.publishEvent(new ApplicationStartupEvent(this));
        } catch (Throwable e) {
            throw new ApplicationStartupException("Error starting messaging server: " + e.getMessage(), e);
        }
    }
    return this;
}
Also used : ApplicationStartupEvent(io.micronaut.runtime.event.ApplicationStartupEvent) ApplicationContext(io.micronaut.context.ApplicationContext) ApplicationStartupException(io.micronaut.runtime.exceptions.ApplicationStartupException)

Aggregations

ApplicationContext (io.micronaut.context.ApplicationContext)1 ApplicationStartupEvent (io.micronaut.runtime.event.ApplicationStartupEvent)1 ApplicationStartupException (io.micronaut.runtime.exceptions.ApplicationStartupException)1