diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java index 43fad72827..77b6224432 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java @@ -25,8 +25,6 @@ import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; import org.springframework.beans.FatalBeanException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; @@ -101,26 +99,19 @@ import org.springframework.web.servlet.DispatcherServlet; RepositoryRestMvcAutoConfiguration.class, HypermediaAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class }) public class EndpointWebMvcAutoConfiguration - implements ApplicationContextAware, BeanFactoryAware, SmartInitializingSingleton { + implements ApplicationContextAware, SmartInitializingSingleton { private static final Log logger = LogFactory .getLog(EndpointWebMvcAutoConfiguration.class); private ApplicationContext applicationContext; - private BeanFactory beanFactory; - @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } - @Override - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = beanFactory; - } - @Bean public ManagementContextResolver managementContextResolver() { return new ManagementContextResolver(this.applicationContext); @@ -339,8 +330,8 @@ public class EndpointWebMvcAutoConfiguration return ConditionOutcome .noMatch(message.because("non WebApplicationContext")); } - ManagementServerPort port = ManagementServerPort.get( - context.getEnvironment()); + ManagementServerPort port = ManagementServerPort + .get(context.getEnvironment()); if (port == ManagementServerPort.SAME) { return ConditionOutcome.match(message.because("port is same")); } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java index 43ee2251de..53e03ed134 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java @@ -301,9 +301,8 @@ public final class ConditionMessage { if (StringUtils.isEmpty(reason)) { return new ConditionMessage(ConditionMessage.this, this.condition); } - return new ConditionMessage(ConditionMessage.this, - this.condition + (StringUtils.isEmpty(this.condition) ? "" : " ") - + reason); + return new ConditionMessage(ConditionMessage.this, this.condition + + (StringUtils.isEmpty(this.condition) ? "" : " ") + reason); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index 5a22d1324e..7db7b272bb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -295,7 +295,7 @@ public class RabbitAutoConfigurationTests { @Test public void testRabbitListenerContainerFactoryWithCustomSettings() { load(new Class[] { MessageConvertersConfiguration.class, - MessageRecoverersConfiguration.class }, + MessageRecoverersConfiguration.class }, "spring.rabbitmq.listener.retry.enabled:true", "spring.rabbitmq.listener.retry.maxAttempts:4", "spring.rabbitmq.listener.retry.initialInterval:2000", @@ -331,11 +331,11 @@ public class RabbitAutoConfigurationTests { dfa = new DirectFieldAccessor(adviceChain[0]); MessageRecoverer messageRecoverer = this.context.getBean("myMessageRecoverer", MessageRecoverer.class); - MethodInvocationRecoverer mir = (MethodInvocationRecoverer) dfa + MethodInvocationRecoverer mir = (MethodInvocationRecoverer) dfa .getPropertyValue("recoverer"); Message message = mock(Message.class); Exception ex = new Exception("test"); - mir.recover(new Object[]{"foo", message}, ex); + mir.recover(new Object[] { "foo", message }, ex); verify(messageRecoverer).recover(message, ex); RetryTemplate retryTemplate = (RetryTemplate) dfa .getPropertyValue("retryOperations"); @@ -415,8 +415,7 @@ public class RabbitAutoConfigurationTests { load(new Class[] { config }, environment); } - private void load(Class[] configs, - String... environment) { + private void load(Class[] configs, String... environment) { AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); applicationContext.register(configs); applicationContext.register(RabbitAutoConfiguration.class); diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index acc9a002be..b1df740d22 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -241,7 +241,7 @@ public class SpringApplicationTests { @Test public void setIgnoreBeanInfoPropertyByDefault() throws Exception { SpringApplication application = new SpringApplication(ExampleConfig.class); - application.setWebEnvironment(false); + application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); String property = System .getProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME); @@ -250,9 +250,10 @@ public class SpringApplicationTests { @Test public void disableIgnoreBeanInfoProperty() throws Exception { - System.setProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME, "false"); + System.setProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME, + "false"); SpringApplication application = new SpringApplication(ExampleConfig.class); - application.setWebEnvironment(false); + application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); String property = System .getProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME); @@ -262,7 +263,7 @@ public class SpringApplicationTests { @Test public void triggersConfigFileApplicationListenerBeforeBinding() throws Exception { SpringApplication application = new SpringApplication(ExampleConfig.class); - application.setWebEnvironment(false); + application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.config.name=bindtoapplication"); Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode"); field.setAccessible(true); @@ -273,7 +274,7 @@ public class SpringApplicationTests { public void bindsSystemPropertyToSpringApplication() throws Exception { System.setProperty("spring.main.banner-mode", "off"); SpringApplication application = new SpringApplication(ExampleConfig.class); - application.setWebEnvironment(false); + application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run(); Field field = ReflectionUtils.findField(SpringApplication.class, "bannerMode"); field.setAccessible(true); @@ -402,8 +403,7 @@ public class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleWebConfig.class); application.setWebApplicationType(WebApplicationType.REACTIVE); this.context = application.run(); - assertThat(this.context) - .isInstanceOf(ReactiveWebApplicationContext.class); + assertThat(this.context).isInstanceOf(ReactiveWebApplicationContext.class); } @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java index adb3a4a011..a13e833b77 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java @@ -809,7 +809,7 @@ public class ConfigFileApplicationListenerTests { @Test public void profileCanBeIncludedWithoutAnyBeingActive() throws Exception { SpringApplication application = new SpringApplication(Config.class); - application.setWebEnvironment(false); + application.setWebApplicationType(WebApplicationType.NONE); this.context = application.run("--spring.profiles.include=dev"); String property = this.context.getEnvironment().getProperty("my.property"); assertThat(property).isEqualTo("fromdevpropertiesfile");