Polish formatting
This commit is contained in:
parent
f39e8a25cf
commit
4279ffeddf
|
@ -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<String> 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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<String, String> form = new LinkedMultiValueMap<String, String>();
|
||||
|
||||
ResponseEntity<Object> result = rest.postForEntity("http://localhost:" + port + "/", form, Object.class);
|
||||
ResponseEntity<Object> result = rest.postForEntity("http://localhost:" + port
|
||||
+ "/", form, Object.class);
|
||||
assertEquals(HttpStatus.FORBIDDEN, result.getStatusCode());
|
||||
|
||||
|
||||
// override method with GET
|
||||
form = new LinkedMultiValueMap<String, String>();
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue