use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class RestartApplicationListenerTests method testInitialize.
private void testInitialize(boolean failed) {
Restarter.clearInstance();
RestartApplicationListener listener = new RestartApplicationListener();
SpringApplication application = new SpringApplication();
ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class);
listener.onApplicationEvent(new ApplicationStartingEvent(application, ARGS));
assertThat(Restarter.getInstance()).isNotEqualTo(nullValue());
assertThat(Restarter.getInstance().isFinished()).isFalse();
listener.onApplicationEvent(new ApplicationPreparedEvent(application, ARGS, context));
if (failed) {
listener.onApplicationEvent(new ApplicationFailedEvent(application, ARGS, context, new RuntimeException()));
} else {
listener.onApplicationEvent(new ApplicationReadyEvent(application, ARGS, context));
}
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class RestartScopeInitializerTests method runApplication.
private ConfigurableApplicationContext runApplication() {
SpringApplication application = new SpringApplication(Config.class);
application.setWebApplicationType(WebApplicationType.NONE);
return application.run();
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class DevToolPropertiesIntegrationTests method postProcessWhenRestarterDisabledAndRemoteSecretNotSetShouldNotAddPropertySource.
@Test
public void postProcessWhenRestarterDisabledAndRemoteSecretNotSetShouldNotAddPropertySource() throws Exception {
Restarter.clearInstance();
Restarter.disable();
SpringApplication application = new SpringApplication(BeanConditionConfiguration.class);
application.setWebApplicationType(WebApplicationType.NONE);
this.context = application.run();
this.thrown.expect(NoSuchBeanDefinitionException.class);
this.context.getBean(MyBean.class);
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class DevToolPropertiesIntegrationTests method classPropertyConditionIsAffectedByDevToolProperties.
@Test
public void classPropertyConditionIsAffectedByDevToolProperties() {
SpringApplication application = new SpringApplication(ClassConditionConfiguration.class);
application.setWebApplicationType(WebApplicationType.NONE);
this.context = application.run();
this.context.getBean(ClassConditionConfiguration.class);
}
use of org.springframework.boot.SpringApplication in project spring-boot by spring-projects.
the class DevToolPropertiesIntegrationTests method postProcessWhenRestarterDisabledAndRemoteSecretSetShouldAddPropertySource.
@Test
public void postProcessWhenRestarterDisabledAndRemoteSecretSetShouldAddPropertySource() throws Exception {
Restarter.clearInstance();
Restarter.disable();
SpringApplication application = new SpringApplication(BeanConditionConfiguration.class);
application.setWebApplicationType(WebApplicationType.NONE);
application.setDefaultProperties(Collections.<String, Object>singletonMap("spring.devtools.remote.secret", "donttell"));
this.context = application.run();
this.context.getBean(MyBean.class);
}
Aggregations