private SpringApplicationBuilder additionalProfiles( Collection<String> additionalProfiles) { this.additionalProfiles = new LinkedHashSet<>(additionalProfiles); this.application.setAdditionalProfiles( StringUtils.toStringArray(this.additionalProfiles)); return this; }
/** * Add to the active Spring profiles for this app (and its parent and children). * @param profiles the profiles to add. * @return the current builder */ public SpringApplicationBuilder profiles(String... profiles) { this.additionalProfiles.addAll(Arrays.asList(profiles)); this.application.setAdditionalProfiles( StringUtils.toStringArray(this.additionalProfiles)); return this; }
public static void main(String[] args) { SpringApplication application = new SpringApplication(SpringBootLesson18Application.class); application.setAdditionalProfiles("prod"); application.run(args); }
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(); app.setAdditionalProfiles(Config.ENVIRONMENT); app.setWebApplicationType(WebApplicationType.SERVLET); app.run(args); }
public static void main(String[] args) throws UnknownHostException { SpringApplication app = new SpringApplication(App.class); SimpleCommandLinePropertySource source = new SimpleCommandLinePropertySource(args); if (!source.containsProperty("spring.profiles.active") && !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) { app.setAdditionalProfiles("production"); } ... }
/** * This is the initializing method when running ParaServer as executable JAR (or WAR), * from the command line: java -jar para.jar. * @param args command line arguments array (same as those in {@code void main(String[] args)} ) * @param sources the application classes that will be scanned */ public static void runAsJAR(String[] args, Class<?>... sources) { // entry point (JAR) SpringApplication app = new SpringApplication(sources); app.setAdditionalProfiles(Config.ENVIRONMENT); app.setWebApplicationType(WebApplicationType.SERVLET); app.setBannerMode(Banner.Mode.OFF); initialize(getCoreModules()); app.run(args); }
/** * This is the initializing method when running ParaServer as executable JAR (or WAR), * from the command line: java -jar para.jar. * @param args command line arguments array (same as those in {@code void main(String[] args)} ) * @param sources the application classes that will be scanned */ public static void runAsJAR(String[] args, Class<?>... sources) { // entry point (JAR) SpringApplication app = new SpringApplication(sources); app.setAdditionalProfiles(Config.ENVIRONMENT); app.setWebApplicationType(WebApplicationType.SERVLET); app.setBannerMode(Banner.Mode.OFF); initialize(getCoreModules()); app.run(args); }
springApplication.setAdditionalProfiles(additionProfile); } else { springApplication.setAdditionalProfiles(additionProfile);