use of org.springframework.context.event.ContextRefreshedEvent in project spring-boot by spring-projects.
the class ConditionEvaluationReportLoggingListenerTests method listenerWithInfoLevelShouldLogAtInfo.
@Test
void listenerWithInfoLevelShouldLogAtInfo(CapturedOutput output) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
ConditionEvaluationReportLoggingListener initializer = new ConditionEvaluationReportLoggingListener(LogLevel.INFO);
initializer.initialize(context);
context.register(Config.class);
context.refresh();
initializer.onApplicationEvent(new ContextRefreshedEvent(context));
assertThat(output).contains("CONDITIONS EVALUATION REPORT");
}
use of org.springframework.context.event.ContextRefreshedEvent in project spring-boot by spring-projects.
the class LocalDevToolsAutoConfigurationTests method liveReloadTriggeredOnContextRefresh.
@Test
void liveReloadTriggeredOnContextRefresh() throws Exception {
this.context = getContext(() -> initializeAndRun(ConfigWithMockLiveReload.class));
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
reset(server);
this.context.publishEvent(new ContextRefreshedEvent(this.context));
then(server).should().triggerReload();
}
use of org.springframework.context.event.ContextRefreshedEvent in project spring-boot by spring-projects.
the class DispatcherServletAutoConfigurationTests method renamesMultipartResolver.
@Test
void renamesMultipartResolver() {
this.contextRunner.withUserConfiguration(MultipartResolverConfiguration.class).run((context) -> {
DispatcherServlet dispatcherServlet = context.getBean(DispatcherServlet.class);
dispatcherServlet.onApplicationEvent(new ContextRefreshedEvent(context));
assertThat(dispatcherServlet.getMultipartResolver()).isInstanceOf(MockMultipartResolver.class);
});
}
use of org.springframework.context.event.ContextRefreshedEvent in project spring-boot by spring-projects.
the class ConditionEvaluationReportLoggingListenerTests method logsDebugOnContextRefresh.
@Test
void logsDebugOnContextRefresh(CapturedOutput output) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
this.initializer.initialize(context);
context.register(Config.class);
context.refresh();
withDebugLogging(() -> this.initializer.onApplicationEvent(new ContextRefreshedEvent(context)));
assertThat(output).contains("CONDITIONS EVALUATION REPORT");
}
use of org.springframework.context.event.ContextRefreshedEvent in project spring-boot by spring-projects.
the class ConditionEvaluationReportLoggingListenerTests method logsOutput.
@Test
void logsOutput(CapturedOutput output) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
this.initializer.initialize(context);
context.register(Config.class);
ConditionEvaluationReport.get(context.getBeanFactory()).recordExclusions(Arrays.asList("com.foo.Bar"));
context.refresh();
withDebugLogging(() -> this.initializer.onApplicationEvent(new ContextRefreshedEvent(context)));
assertThat(output).contains("not a servlet web application (OnWebApplicationCondition)");
}
Aggregations