/** * Environment for the application context. * @param environment the environment to set. * @return the current builder */ public SpringApplicationBuilder environment(ConfigurableEnvironment environment) { this.application.setEnvironment(environment); this.environment = environment; return this; }
public synchronized ConfigurableApplicationContext doRestart() { if (this.context != null) { if (this.integrationShutdown != null) { this.integrationShutdown.stop(this.timeout); } this.application.setEnvironment(this.context.getEnvironment()); close(); // If running in a webapp then the context classloader is probably going to // die so we need to revert to a safe place before starting again overrideClassLoaderForRestart(); this.context = this.application.run(this.args); } return this.context; }
public synchronized ConfigurableApplicationContext doRestart() { if (this.context != null) { if (this.integrationShutdown != null) { this.integrationShutdown.stop(this.timeout); } this.application.setEnvironment(this.context.getEnvironment()); close(); // If running in a webapp then the context classloader is probably going to // die so we need to revert to a safe place before starting again overrideClassLoaderForRestart(); this.context = this.application.run(this.args); } return this.context; }
private SpringApplication builder(Class<?> type, StandardEnvironment environment) { SpringApplication application; if (!isFunctional(environment)) { application = new SpringApplication(type); } else { application = FunctionalSpringApplicationCreator.create(type); } application.setEnvironment(environment); application.setRegisterShutdownHook(false); return application; }
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, getInlinedProperties(config)); application.setEnvironment(environment); List<ApplicationContextInitializer<?>> initializers = getInitializers(config, application);