Example usage for org.springframework.boot.builder SpringApplicationBuilder application

List of usage examples for org.springframework.boot.builder SpringApplicationBuilder application

Introduction

In this page you can find the example usage for org.springframework.boot.builder SpringApplicationBuilder application.

Prototype

SpringApplication application

To view the source code for org.springframework.boot.builder SpringApplicationBuilder application.

Click Source Link

Usage

From source file:org.osiam.Osiam.java

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) {
    applicationBuilder.application().setDefaultProperties(DEFAULT_PROPERTIES);
    applicationBuilder.application().addListeners(new OsiamHome());
    return applicationBuilder;
}

From source file:org.springframework.cloud.config.server.environment.NativeEnvironmentRepository.java

@Override
public Environment findOne(String config, String profile, String label) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(PropertyPlaceholderAutoConfiguration.class);
    ConfigurableEnvironment environment = getEnvironment(profile);
    builder.environment(environment);/*from w ww .  j  ava  2  s .c om*/
    builder.web(false).bannerMode(Mode.OFF);
    if (!logger.isDebugEnabled()) {
        // Make the mini-application startup less verbose
        builder.logStartupInfo(false);
    }
    String[] args = getArgs(config, profile, label);
    // Explicitly set the listeners (to exclude logging listener which would change
    // log levels in the caller)
    builder.application().setListeners(Arrays.asList(new ConfigFileApplicationListener()));
    ConfigurableApplicationContext context = builder.run(args);
    environment.getPropertySources().remove("profiles");
    try {
        return clean(new PassthruEnvironmentRepository(environment).findOne(config, profile, label));
    } finally {
        context.close();
    }
}

From source file:org.springframework.cloud.config.server.NativeEnvironmentRepository.java

@Override
public Environment findOne(String config, String profile, String label) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(PropertyPlaceholderAutoConfiguration.class);
    ConfigurableEnvironment environment = getEnvironment(profile);
    builder.environment(environment);//ww w .ja  va  2s .co m
    builder.web(false).showBanner(false);
    String[] args = getArgs(config, label);
    // Explicitly set the listeners (to exclude logging listener which would change
    // log levels in the caller)
    builder.application().setListeners(Collections.singletonList(new ConfigFileApplicationListener()));
    ConfigurableApplicationContext context = builder.run(args);
    environment.getPropertySources().remove("profiles");
    try {
        return clean(new PassthruEnvironmentRepository(environment).findOne(config, profile, label));
    } finally {
        context.close();
    }
}