Example usage for org.springframework.boot.context.event ApplicationEnvironmentPreparedEvent getSpringApplication

List of usage examples for org.springframework.boot.context.event ApplicationEnvironmentPreparedEvent getSpringApplication

Introduction

In this page you can find the example usage for org.springframework.boot.context.event ApplicationEnvironmentPreparedEvent getSpringApplication.

Prototype

public SpringApplication getSpringApplication() 

Source Link

Usage

From source file:org.springframework.boot.context.config.ConfigFileApplicationListener.java

private void onApplicationEnvironmentPreparedEvent(ApplicationEnvironmentPreparedEvent event) {
    List<EnvironmentPostProcessor> postProcessors = SpringFactoriesLoader
            .loadFactories(EnvironmentPostProcessor.class, getClass().getClassLoader());
    postProcessors.add(this);
    for (EnvironmentPostProcessor postProcessor : postProcessors) {
        postProcessor.postProcessEnvironment(event.getEnvironment(), event.getSpringApplication());
    }//  ww  w .  ja  v  a 2s .c om
}

From source file:org.springframework.boot.context.logging.LoggingApplicationListener.java

private void onApplicationEnvironmentPreparedEvent(ApplicationEnvironmentPreparedEvent event) {
    if (this.loggingSystem == null) {
        this.loggingSystem = LoggingSystem.get(event.getSpringApplication().getClassLoader());
    }/*from ww  w .  j a  v a2 s  . c om*/
    initialize(event.getEnvironment(), event.getSpringApplication().getClassLoader());
}