Example usage for org.springframework.boot SpringApplication setAdditionalProfiles

List of usage examples for org.springframework.boot SpringApplication setAdditionalProfiles

Introduction

In this page you can find the example usage for org.springframework.boot SpringApplication setAdditionalProfiles.

Prototype

public void setAdditionalProfiles(String... profiles) 

Source Link

Document

Set additional profile values to use (on top of those set in system or command line properties).

Usage

From source file:fi.hsl.parkandride.PWGen.java

public static void main(String[] args) {
    SpringApplication application = new SpringApplication(PWGen.class);
    application.setWebEnvironment(false);
    application.setAdditionalProfiles("pwgen");
    application.run(args);//www.  ja  v  a 2  s  .  c  o  m
}

From source file:fi.hsl.parkandride.ExportQTypes.java

public static void main(String[] args) {
    SpringApplication application = new SpringApplication(ExportQTypes.class);
    application.setWebEnvironment(false);
    application.setAdditionalProfiles("export_qtypes");
    application.run(args);//w ww.j  a  va2  s.c o  m
}

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

public static void main(String[] args) {
    final SpringApplication app = new SpringApplication(BackendApplication.class);
    final SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args);
    if (!source.containsProperty("spring.profiles.active")
            && !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {
        app.setAdditionalProfiles("dev");
    }//  w ww.j a v  a  2 s .  co  m
    app.run(args).getEnvironment();
}

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

public static void main(String[] args) {
    ((ch.qos.logback.classic.Logger) logger).setLevel(ch.qos.logback.classic.Level.TRACE);
    SpringApplication app = new SpringApplication(ScooldServer.class);
    initConfig();/*from  w  w w . ja  v a  2 s  .  com*/
    app.setAdditionalProfiles(Config.ENVIRONMENT);
    app.setWebApplicationType(WebApplicationType.SERVLET);
    app.run(args);
}

From source file:alfio.config.SpringBootLauncher.java

/**
 * Entry point for spring boot/*from  ww  w .  j av a 2  s. c o  m*/
 * @param args original arguments
 */
public static void main(String[] args) {
    Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
    String profiles = System.getProperty("spring.profiles.active", "");

    SpringApplication application = new SpringApplication(SpringBootInitializer.class,
            RepositoryConfiguration.class, DataSourceConfiguration.class, WebSecurityConfig.class,
            MvcConfiguration.class);
    List<String> additionalProfiles = new ArrayList<>();
    additionalProfiles.add(Initializer.PROFILE_SPRING_BOOT);
    if ("true".equals(System.getenv("ALFIO_LOG_STDOUT_ONLY"))) {
        // -> will load application-stdout.properties on top to override the logger configuration
        additionalProfiles.add("stdout");
    }
    if ("true".equals(System.getenv("ALFIO_DEMO_ENABLED"))) {
        additionalProfiles.add(Initializer.PROFILE_DEMO);
    }
    if ("true".equals(System.getenv("ALFIO_JDBC_SESSION_ENABLED"))) {
        additionalProfiles.add(Initializer.PROFILE_JDBC_SESSION);
    }
    application.setAdditionalProfiles(additionalProfiles.toArray(new String[additionalProfiles.size()]));
    ConfigurableApplicationContext applicationContext = application.run(args);
    ConfigurableEnvironment environment = applicationContext.getEnvironment();
    log.info("profiles: requested {}, active {}", profiles,
            String.join(", ", (CharSequence[]) environment.getActiveProfiles()));
    if ("true".equals(System.getProperty("startDBManager"))) {
        launchHsqlGUI();
    }
}

From source file:school.Application.java

/**
 * Set a default profile if it has not been set
 *//*w  ww. ja  v  a2 s. co m*/
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active")) {
        app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
    }
}

From source file:com.mejmo.appletraus.server.AppletRausServerApplication.java

private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active")) {
        app.setAdditionalProfiles(getProductionProfileName());
    }/*from w ww. j a  v a 2 s.co  m*/
}

From source file:fi.helsinki.opintoni.Application.java

/**
 * Set a default profile if it has not been set
 *///from   w w w .j  a va 2  s.  co  m
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active")) {
        app.setAdditionalProfiles(Constants.SPRING_PROFILE_LOCAL_DEVELOPMENT);
    }
}

From source file:de.whs.poodle.cli.PoodleCli.java

public static void run(String[] args) {
    SpringApplication app = new SpringApplication(PoodleCli.class);

    // don't try to start tomcat etc.
    app.setWebEnvironment(false);/*from ww  w.  ja va2s.c om*/

    // make sure PoodleCliCommandLineRunner and application-cli.properties are loaded
    app.setAdditionalProfiles("cli");

    /* Run the app. Spring will initialize everything, run the
     * PoodleCliCommandLineRunner and then realize there is nothing
     * else to do and exit automatically. */
    app.run(args);
}

From source file:com.acapulcoapp.alloggiatiweb.AddRegion.java

/**
 * If no profile has been configured, set by default the "dev" profile.
 *//*from  w w  w .ja  v  a  2 s  .  co  m*/
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
    if (!source.containsProperty("spring.profiles.active")
            && !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {

        app.setAdditionalProfiles("dev");
        //public static final String SPRING_PROFILE_DEVELOPMENT = "dev";
    }
}