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

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

Introduction

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

Prototype

public SpringApplicationBuilder profiles(String... profiles) 

Source Link

Document

Add to the active Spring profiles for this app (and its parent and children).

Usage

From source file:com.teradata.benchto.driver.DriverApp.java

public static void main(String[] args) throws Exception {
    CommandLine commandLine = processArguments(args);

    SpringApplicationBuilder applicationBuilder = new SpringApplicationBuilder(DriverApp.class).web(false)
            .properties();/*from w  ww.ja  v  a2 s . c  om*/
    if (commandLine.hasOption("profile")) {
        applicationBuilder.profiles(commandLine.getOptionValue("profile"));
    }
    ConfigurableApplicationContext ctx = applicationBuilder.run();
    ExecutionDriver executionDriver = ctx.getBean(ExecutionDriver.class);

    Thread.currentThread().setName("main");

    try {
        executionDriver.execute();
        System.exit(0);
    } catch (Throwable e) {
        logException(e);
        System.exit(1);
    }
}

From source file:dk.dma.nogoservice.Application.java

public static void main(String[] args) {
    SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
    ArrayList<String> profiles = Lists.newArrayList(ApiProfiles.PRODUCTION, ApiProfiles.SECURITY);
    if (Boolean.getBoolean("disableSecurity")) {
        profiles.remove(ApiProfiles.SECURITY);
    }/*from w  w w  .  j  a  v a  2 s  .  c  om*/
    builder.profiles(profiles.toArray(new String[profiles.size()])).headless(false).run(args);
}

From source file:org.obiba.mica.Application.java

/**
 * Set a default profile if it has not been set
 *//*  w  w  w  .  j  av a  2 s. c o m*/
private static void addDefaultProfile(SpringApplicationBuilder app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active")
            && System.getProperty("spring.profiles.active") == null) {
        app.profiles(Profiles.PROD);
    }
}

From source file:org.systemexception.springmongorest.Application.java

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    application.profiles("production");
    return application.sources(Application.class);
}

From source file:com.jiwhiz.JiwhizBlogWebXml.java

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.profiles(addDefaultProfile()).showBanner(false).sources(JiwhizBlogWebApplication.class);
}

From source file:org.obiba.mica.ApplicationWebXml.java

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.profiles(addDefaultProfile()).bannerMode(Banner.Mode.OFF).sources(Application.class);
}

From source file:com.todo.backend.WebInitializer.java

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    String profile = System.getProperty("spring.profiles.active");
    return application.profiles(profile == null ? "dev" : profile).sources(BackendApplication.class);
}

From source file:com.erudika.scoold.ScooldServer.java

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder app) {
    initConfig();/*w  w  w.  j a  v a2 s.  c  o  m*/
    app.profiles(Config.ENVIRONMENT);
    app.web(WebApplicationType.SERVLET);
    return app.sources(ScooldServer.class);
}