diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.java index d07d36cb2d..bcb27ca79d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelector.java @@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -104,11 +103,8 @@ class EnableAutoConfigurationImportSelector implements DeferredImportSelector, private List getExcludeAutoConfigurationsProperty() { RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(this.environment, "spring.autoconfigure."); - String[] value = resolver.getProperty("exclude", String[].class); - if (value != null) { - return Arrays.asList(value); - } - return Collections.emptyList(); + String[] exclude = resolver.getProperty("exclude", String[].class); + return (Arrays.asList(exclude == null ? new String[0] : exclude)); } @Override diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfiguration.java index f732b3939b..a027848b09 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfiguration.java @@ -23,7 +23,7 @@ import org.springframework.context.annotation.Configuration; /** * {@link EnableAutoConfiguration Auto-configuration} for {@link ConfigurationProperties} - * annotated beans. Automatically any bean annotated with {@code @ConfigurationProperties}. + * beans. Automatically any bean annotated with {@code @ConfigurationProperties}. * * @author Stephane Nicoll * @since 1.3.0 diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfiguration.java index 394e652a9d..c4122266a1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfiguration.java @@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.mail; import java.util.Map; import java.util.Properties; + import javax.activation.MimeType; import javax.mail.Session; import javax.mail.internet.MimeMessage; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelectorTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelectorTests.java index ac55ddb942..e24edb5634 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelectorTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/EnableAutoConfigurationImportSelectorTests.java @@ -109,8 +109,8 @@ public class EnableAutoConfigurationImportSelectorTests { @Test public void propertyExclusionsAreApplied() { - configureExclusions(new String[0], new String[0], new String[] { - FreeMarkerAutoConfiguration.class.getName()}); + configureExclusions(new String[0], new String[0], + new String[] { FreeMarkerAutoConfiguration.class.getName() }); String[] imports = this.importSelector.selectImports(this.annotationMetadata); assertThat(imports.length, is(equalTo(getAutoConfigurationClassNames().size() - 1))); @@ -121,8 +121,8 @@ public class EnableAutoConfigurationImportSelectorTests { @Test public void severalPropertyExclusionsAreApplied() { configureExclusions(new String[0], new String[0], new String[] { - FreeMarkerAutoConfiguration.class.getName(), VelocityAutoConfiguration - .class.getName()}); + FreeMarkerAutoConfiguration.class.getName(), + VelocityAutoConfiguration.class.getName() }); String[] imports = this.importSelector.selectImports(this.annotationMetadata); assertThat(imports.length, @@ -160,8 +160,7 @@ public class EnableAutoConfigurationImportSelectorTests { nameExclusion); if (propertyExclusion.length > 0) { String value = StringUtils.arrayToCommaDelimitedString(propertyExclusion); - this.environment.setProperty("spring.autoconfigure.exclude", - value); + this.environment.setProperty("spring.autoconfigure.exclude", value); } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfigurationTests.java index 9588b8d005..9c3c24d1ce 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfigurationTests.java @@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.context; import org.junit.After; import org.junit.Test; - import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.test.EnvironmentTestUtils; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -45,29 +44,27 @@ public class ConfigurationPropertiesAutoConfigurationTests { @Test public void processAnnotatedBean() { - load(new Class[] {SampleBean.class, ConfigurationPropertiesAutoConfiguration.class}, - "foo.name:test"); + load(new Class[] { SampleBean.class, + ConfigurationPropertiesAutoConfiguration.class }, "foo.name:test"); assertThat(this.context.getBean(SampleBean.class).getName(), is("test")); } @Test public void processAnnotatedBeanNoAutoConfig() { - load(new Class[] {SampleBean.class}, "foo.name:test"); + load(new Class[] { SampleBean.class }, "foo.name:test"); assertThat(this.context.getBean(SampleBean.class).getName(), is("default")); } - private void load(Class[] configs, - String... environment) { + private void load(Class[] configs, String... environment) { this.context = new AnnotationConfigApplicationContext(); this.context.register(configs); EnvironmentTestUtils.addEnvironment(this.context, environment); this.context.refresh(); } - @Component @ConfigurationProperties("foo") - private static class SampleBean { + static class SampleBean { private String name = "default"; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java index 7fb57942fe..96184c4371 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfigurationTests.java @@ -170,20 +170,20 @@ public class SpringBootWebSecurityConfigurationTests { // gh-3447 @Test - public void testHiddenHttpMethodFilterOrderedFirst() - throws Exception { + public void testHiddenHttpMethodFilterOrderedFirst() throws Exception { this.context = SpringApplication.run(DenyPostRequestConfig.class, "--server.port=0"); - int port = Integer.parseInt(this.context.getEnvironment().getProperty("local.server.port")); + int port = Integer.parseInt(this.context.getEnvironment().getProperty( + "local.server.port")); TestRestTemplate rest = new TestRestTemplate(); // not overriding causes forbidden MultiValueMap form = new LinkedMultiValueMap(); - ResponseEntity result = rest.postForEntity("http://localhost:" + port + "/", form, Object.class); + ResponseEntity result = rest.postForEntity("http://localhost:" + port + + "/", form, Object.class); assertEquals(HttpStatus.FORBIDDEN, result.getStatusCode()); - // override method with GET form = new LinkedMultiValueMap(); form.add("_method", "GET"); @@ -257,9 +257,8 @@ public class SpringBootWebSecurityConfigurationTests { @Override protected void configure(HttpSecurity http) throws Exception { - http - .authorizeRequests() - .antMatchers(HttpMethod.POST, "/**").denyAll(); + http.authorizeRequests().antMatchers(HttpMethod.POST, "/**").denyAll(); } + } }