Search in sources :

Example 1 with StartupEvent

use of io.micronaut.context.event.StartupEvent in project micronaut-core by micronaut-projects.

the class DefaultBeanContext method start.

/**
 * The start method will read all bean definition classes found on the classpath and initialize any pre-required
 * state.
 */
@Override
public synchronized BeanContext start() {
    if (!isRunning()) {
        if (initializing.compareAndSet(false, true)) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Starting BeanContext");
            }
            finalizeConfiguration();
            if (LOG.isDebugEnabled()) {
                String activeConfigurations = beanConfigurations.values().stream().filter(config -> config.isEnabled(this)).map(BeanConfiguration::getName).collect(Collectors.joining(","));
                if (StringUtils.isNotEmpty(activeConfigurations)) {
                    LOG.debug("Loaded active configurations: {}", activeConfigurations);
                }
            }
            if (LOG.isDebugEnabled()) {
                LOG.debug("BeanContext Started.");
            }
            publishEvent(new StartupEvent(this));
        }
        running.set(true);
        initializing.set(false);
    }
    return this;
}
Also used : StartupEvent(io.micronaut.context.event.StartupEvent)

Aggregations

StartupEvent (io.micronaut.context.event.StartupEvent)1