Remove ConditionEvaluationReportLoggingListener usage if possible

See gh-19159
pull/19328/head
Johnny Lim 5 years ago committed by Stephane Nicoll
parent ce16c9e945
commit f234d9c0ec

@ -31,12 +31,10 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration; import org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration; import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -62,8 +60,7 @@ class CloudFoundryInfoEndpointWebExtensionTests {
@Test @Test
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
void gitFullDetailsAlwaysPresent() { void gitFullDetailsAlwaysPresent() {
this.contextRunner.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO)) this.contextRunner.run((context) -> {
.run((context) -> {
CloudFoundryInfoEndpointWebExtension extension = context CloudFoundryInfoEndpointWebExtension extension = context
.getBean(CloudFoundryInfoEndpointWebExtension.class); .getBean(CloudFoundryInfoEndpointWebExtension.class);
Map<String, Object> git = (Map<String, Object>) extension.info().get("git"); Map<String, Object> git = (Map<String, Object>) extension.info().get("git");

@ -30,10 +30,8 @@ import org.springframework.boot.actuate.endpoint.web.EndpointServlet;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint; import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration; import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext; import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
@ -60,12 +58,11 @@ abstract class AbstractEndpointRequestIntegrationTests {
@Test @Test
void toAllEndpointsShouldMatch() { void toAllEndpointsShouldMatch() {
getContextRunner().withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO)) getContextRunner().withPropertyValues("spring.security.user.password=password").run((context) -> {
.withPropertyValues("spring.security.user.password=password").run((context) -> {
WebTestClient webTestClient = getWebTestClient(context); WebTestClient webTestClient = getWebTestClient(context);
webTestClient.get().uri("/actuator/e2").exchange().expectStatus().isUnauthorized(); webTestClient.get().uri("/actuator/e2").exchange().expectStatus().isUnauthorized();
webTestClient.get().uri("/actuator/e2").header("Authorization", getBasicAuth()).exchange() webTestClient.get().uri("/actuator/e2").header("Authorization", getBasicAuth()).exchange().expectStatus()
.expectStatus().isOk(); .isOk();
}); });
} }

@ -21,8 +21,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.aop.config.AopConfigUtils; import org.springframework.aop.config.AopConfigUtils;
import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.testsupport.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
@ -41,8 +39,7 @@ class NonAspectJAopAutoConfigurationTests {
@Test @Test
void whenAspectJIsAbsentAndProxyTargetClassIsEnabledProxyCreatorBeanIsDefined() { void whenAspectJIsAbsentAndProxyTargetClassIsEnabledProxyCreatorBeanIsDefined() {
this.contextRunner.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO)) this.contextRunner.run((context) -> {
.run((context) -> {
BeanDefinition autoProxyCreator = context.getBeanFactory() BeanDefinition autoProxyCreator = context.getBeanFactory()
.getBeanDefinition(AopConfigUtils.AUTO_PROXY_CREATOR_BEAN_NAME); .getBeanDefinition(AopConfigUtils.AUTO_PROXY_CREATOR_BEAN_NAME);
assertThat(autoProxyCreator.getPropertyValues().get("proxyTargetClass")).isEqualTo(Boolean.TRUE); assertThat(autoProxyCreator.getPropertyValues().get("proxyTargetClass")).isEqualTo(Boolean.TRUE);

@ -31,9 +31,7 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
import org.springframework.boot.autoconfigure.data.mongo.city.City; import org.springframework.boot.autoconfigure.data.mongo.city.City;
import org.springframework.boot.autoconfigure.data.mongo.country.Country; import org.springframework.boot.autoconfigure.data.mongo.country.Country;
import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -65,8 +63,7 @@ class MongoDataAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class, .withConfiguration(AutoConfigurations.of(PropertyPlaceholderAutoConfiguration.class,
MongoAutoConfiguration.class, MongoDataAutoConfiguration.class)) MongoAutoConfiguration.class, MongoDataAutoConfiguration.class));
.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO));
@Test @Test
void templateExists() { void templateExists() {

@ -23,8 +23,6 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
@ -43,7 +41,6 @@ class JerseyAutoConfigurationTests {
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner() private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(JerseyAutoConfiguration.class)) .withConfiguration(AutoConfigurations.of(JerseyAutoConfiguration.class))
.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.INFO))
.withUserConfiguration(ResourceConfigConfiguration.class); .withUserConfiguration(ResourceConfigConfiguration.class);
@Test @Test

Loading…
Cancel
Save