Skip to content

Commit 6193b64

Browse files
committed
Polish
1 parent db41fb1 commit 6193b64

File tree

57 files changed

+364
-310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+364
-310
lines changed

CONTRIBUTING.adoc

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ something, or simply want to hack on the code this document should help you get
66

77

88
== Using GitHub issues
9-
109
We use GitHub issues to track bugs and enhancements. If you have a general usage question
1110
please ask on http://stackoverflow.com[Stack Overflow]. The Spring Boot team and the
1211
broader community monitor the http://stackoverflow.com/tags/spring-boot[`spring-boot`]

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
@Configuration
6767
@AutoConfigureBefore(EndpointAutoConfiguration.class)
6868
@AutoConfigureAfter({ DataSourceAutoConfiguration.class, CacheAutoConfiguration.class,
69-
MetricRepositoryAutoConfiguration.class, CacheStatisticsAutoConfiguration.class,
70-
IntegrationAutoConfiguration.class })
69+
MetricRepositoryAutoConfiguration.class, CacheStatisticsAutoConfiguration.class,
70+
IntegrationAutoConfiguration.class })
7171
public class PublicMetricsAutoConfiguration {
7272

7373
@Autowired(required = false)

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ShellProperties.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public class ShellProperties {
4242
private static Log logger = LogFactory.getLog(ShellProperties.class);
4343

4444
/**
45-
* Authentication type. Auto-detected according to the environment (i.e. if
46-
* Spring Security is available, "spring" is used by default).
45+
* Authentication type. Auto-detected according to the environment (i.e. if Spring
46+
* Security is available, "spring" is used by default).
4747
*/
4848
private String auth = "simple";
4949

spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfigurationTests.java

+11-10
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure;
1818

19-
import static org.hamcrest.Matchers.hasKey;
20-
import static org.junit.Assert.assertEquals;
21-
import static org.junit.Assert.assertNotNull;
22-
import static org.junit.Assert.assertThat;
23-
import static org.junit.Assert.fail;
24-
import static org.mockito.BDDMockito.given;
25-
import static org.mockito.Mockito.mock;
26-
2719
import java.sql.Connection;
2820
import java.sql.SQLException;
2921
import java.util.Collection;
@@ -67,6 +59,14 @@
6759

6860
import com.zaxxer.hikari.HikariDataSource;
6961

62+
import static org.hamcrest.Matchers.hasKey;
63+
import static org.junit.Assert.assertEquals;
64+
import static org.junit.Assert.assertNotNull;
65+
import static org.junit.Assert.assertThat;
66+
import static org.junit.Assert.fail;
67+
import static org.mockito.BDDMockito.given;
68+
import static org.mockito.Mockito.mock;
69+
7070
/**
7171
* Tests for {@link PublicMetricsAutoConfiguration}.
7272
*
@@ -150,7 +150,7 @@ public void multipleDataSources() {
150150
jdbcTemplate.execute(new ConnectionCallback<Void>() {
151151
@Override
152152
public Void doInConnection(Connection connection) throws SQLException,
153-
DataAccessException {
153+
DataAccessException {
154154
return null;
155155
}
156156
});
@@ -246,7 +246,8 @@ private void loadWeb(Class<?>... config) {
246246
}
247247
context.register(DataSourcePoolMetadataProvidersConfiguration.class,
248248
CacheStatisticsAutoConfiguration.class,
249-
PublicMetricsAutoConfiguration.class, MockEmbeddedServletContainerFactory.class);
249+
PublicMetricsAutoConfiguration.class,
250+
MockEmbeddedServletContainerFactory.class);
250251
context.refresh();
251252
this.context = context;
252253
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java

+17-17
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
package org.springframework.boot.autoconfigure;
1818

19-
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
20-
import static org.springframework.util.StringUtils.trimAllWhitespace;
21-
2219
import java.io.IOException;
2320
import java.nio.charset.Charset;
2421
import java.util.Iterator;
@@ -44,6 +41,9 @@
4441
import org.springframework.util.ConcurrentReferenceHashMap;
4542
import org.springframework.util.StringUtils;
4643

44+
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
45+
import static org.springframework.util.StringUtils.trimAllWhitespace;
46+
4747
/**
4848
* {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}.
4949
*
@@ -52,7 +52,7 @@
5252
* @author Eddú Meléndez
5353
*/
5454
@Configuration
55-
@ConditionalOnMissingBean(value=MessageSource.class, search=SearchStrategy.CURRENT)
55+
@ConditionalOnMissingBean(value = MessageSource.class, search = SearchStrategy.CURRENT)
5656
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
5757
@Conditional(ResourceBundleCondition.class)
5858
@EnableConfigurationProperties
@@ -81,8 +81,8 @@ public class MessageSourceAutoConfiguration {
8181

8282
/**
8383
* Set whether to fall back to the system Locale if no files for a specific Locale
84-
* have been found. if this is turned off, the only fallback will be the default
85-
* file (e.g. "messages.properties" for basename "messages").
84+
* have been found. if this is turned off, the only fallback will be the default file
85+
* (e.g. "messages.properties" for basename "messages").
8686
*/
8787
private boolean fallbackToSystemLocale = true;
8888

@@ -91,7 +91,7 @@ public MessageSource messageSource() {
9191
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
9292
if (StringUtils.hasText(this.basename)) {
9393
messageSource
94-
.setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(this.basename)));
94+
.setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(this.basename)));
9595
}
9696
if (this.encoding != null) {
9797
messageSource.setDefaultEncoding(this.encoding.name());
@@ -167,7 +167,7 @@ private ConditionOutcome getMatchOutcomeForBasename(ConditionContext context,
167167
private Resource[] getResources(ClassLoader classLoader, String name) {
168168
try {
169169
return new SkipPatternPathMatchingResourcePatternResolver(classLoader)
170-
.getResources("classpath*:" + name + "*.properties");
170+
.getResources("classpath*:" + name + "*.properties");
171171
}
172172
catch (Exception ex) {
173173
return NO_RESOURCES;
@@ -181,7 +181,7 @@ private Resource[] getResources(ClassLoader classLoader, String name) {
181181
* contain messages.properties.
182182
*/
183183
private static class SkipPatternPathMatchingResourcePatternResolver extends
184-
PathMatchingResourcePatternResolver {
184+
PathMatchingResourcePatternResolver {
185185

186186
private static final ClassLoader ROOT_CLASSLOADER;
187187
static {
@@ -198,14 +198,14 @@ private static class SkipPatternPathMatchingResourcePatternResolver extends
198198
}
199199

200200
private static final String[] SKIPPED = { "aspectjweaver-", "hibernate-core-",
201-
"hsqldb-", "jackson-annotations-", "jackson-core-", "jackson-databind-",
202-
"javassist-", "snakeyaml-", "spring-aop-", "spring-beans-",
203-
"spring-boot-", "spring-boot-actuator-", "spring-boot-autoconfigure-",
204-
"spring-core-", "spring-context-", "spring-data-commons-",
205-
"spring-expression-", "spring-jdbc-", "spring-orm-", "spring-tx-",
206-
"spring-web-", "spring-webmvc-", "tomcat-embed-", "joda-time-",
207-
"hibernate-entitymanager-", "hibernate-validator-", "logback-classic-",
208-
"logback-core-", "thymeleaf-" };
201+
"hsqldb-", "jackson-annotations-", "jackson-core-", "jackson-databind-",
202+
"javassist-", "snakeyaml-", "spring-aop-", "spring-beans-",
203+
"spring-boot-", "spring-boot-actuator-", "spring-boot-autoconfigure-",
204+
"spring-core-", "spring-context-", "spring-data-commons-",
205+
"spring-expression-", "spring-jdbc-", "spring-orm-", "spring-tx-",
206+
"spring-web-", "spring-webmvc-", "tomcat-embed-", "joda-time-",
207+
"hibernate-entitymanager-", "hibernate-validator-", "logback-classic-",
208+
"logback-core-", "thymeleaf-" };
209209

210210
public SkipPatternPathMatchingResourcePatternResolver(ClassLoader classLoader) {
211211
super(classLoader);

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/SpringBootApplication.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@
6363
String[] excludeName() default {};
6464

6565
/**
66-
* Base packages to scan for annotated components.
67-
* <p>Use {@link #scanBasePackageClasses} for a type-safe alternative to
68-
* String-based package names.
66+
* Base packages to scan for annotated components. Use {@link #scanBasePackageClasses}
67+
* for a type-safe alternative to String-based package names.
6968
* @return base packages to scan
7069
* @since 1.3.0
7170
*/
7271
@AliasFor(annotation = ComponentScan.class, attribute = "basePackages")
7372
String[] scanBasePackages() default {};
7473

7574
/**
76-
* Type-safe alternative to {@link #scanBasePackages} for specifying the packages
77-
* to scan for annotated components. The package of each class specified will be scanned.
78-
* <p>Consider creating a special no-op marker class or interface in each package
79-
* that serves no purpose other than being referenced by this attribute.
75+
* Type-safe alternative to {@link #scanBasePackages} for specifying the packages to
76+
* scan for annotated components. The package of each class specified will be scanned.
77+
* <p>
78+
* Consider creating a special no-op marker class or interface in each package that
79+
* serves no purpose other than being referenced by this attribute.
8080
* @return base packages to scan
8181
* @since 1.3.0
8282
*/

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.nio.charset.Charset;
2020
import java.util.LinkedHashMap;
2121
import java.util.Map;
22+
2223
import javax.sql.DataSource;
2324

2425
import org.springframework.beans.factory.BeanClassLoaderAware;
@@ -48,8 +49,8 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
4849
private String name = "testdb";
4950

5051
/**
51-
* Fully qualified name of the connection pool implementation to use. By default,
52-
* it is auto-detected from the classpath.
52+
* Fully qualified name of the connection pool implementation to use. By default, it
53+
* is auto-detected from the classpath.
5354
*/
5455
private Class<? extends DataSource> type;
5556

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ public static class Hibernate {
134134

135135
/**
136136
* DDL mode. This is actually a shortcut for the "hibernate.hbm2ddl.auto"
137-
* property. Default to "create-drop" when using an embedded database,
138-
* "none" otherwise.
137+
* property. Default to "create-drop" when using an embedded database, "none"
138+
* otherwise.
139139
*/
140140
private String ddlAuto;
141141

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/AuthenticationManagerConfiguration.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public class AuthenticationManagerConfiguration {
6969
private static Log logger = LogFactory
7070
.getLog(AuthenticationManagerConfiguration.class);
7171

72-
@SuppressWarnings("unused")
7372
@Autowired
7473
private List<SecurityPrerequisite> dependencies;
7574

@@ -112,7 +111,7 @@ public static SpringBootAuthenticationConfigurerAdapter springBootAuthentication
112111
*/
113112
@Order(Ordered.LOWEST_PRECEDENCE - 100)
114113
private static class SpringBootAuthenticationConfigurerAdapter extends
115-
GlobalAuthenticationConfigurerAdapter {
114+
GlobalAuthenticationConfigurerAdapter {
116115

117116
private final SecurityProperties securityProperties;
118117

@@ -152,7 +151,7 @@ public void init(AuthenticationManagerBuilder auth) throws Exception {
152151
* </ul>
153152
*/
154153
private static class DefaultInMemoryUserDetailsManagerConfigurer extends
155-
InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> {
154+
InMemoryUserDetailsManagerConfigurer<AuthenticationManagerBuilder> {
156155

157156
private final SecurityProperties securityProperties;
158157

@@ -169,7 +168,7 @@ public void configure(AuthenticationManagerBuilder auth) throws Exception {
169168
User user = this.securityProperties.getUser();
170169
if (user.isDefaultPassword()) {
171170
logger.info("\n\nUsing default security password: " + user.getPassword()
172-
+ "\n");
171+
+ "\n");
173172
}
174173
Set<String> roles = new LinkedHashSet<String>(user.getRole());
175174
withUser(user.getName()).password(user.getPassword()).roles(
@@ -197,7 +196,7 @@ private void setField(Object target, String name, Object value) {
197196
*/
198197
@Component
199198
protected static class AuthenticationManagerConfigurationListener implements
200-
SmartInitializingSingleton {
199+
SmartInitializingSingleton {
201200

202201
@Autowired
203202
private AuthenticationEventPublisher eventPublisher;
@@ -219,7 +218,7 @@ public void afterSingletonsInstantiated() {
219218
private void configureAuthenticationManager(AuthenticationManager manager) {
220219
if (manager instanceof ProviderManager) {
221220
((ProviderManager) manager)
222-
.setAuthenticationEventPublisher(this.eventPublisher);
221+
.setAuthenticationEventPublisher(this.eventPublisher);
223222
}
224223
}
225224

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
@EnableConfigurationProperties
5151
@Import({ SpringBootWebSecurityConfiguration.class,
5252
AuthenticationManagerConfiguration.class,
53-
BootGlobalAuthenticationConfiguration.class,
54-
SecurityDataConfiguration.class })
53+
BootGlobalAuthenticationConfiguration.class, SecurityDataConfiguration.class })
5554
public class SecurityAutoConfiguration {
5655

5756
@Bean

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityDataConfiguration.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.boot.autoconfigure.security;
1718

1819
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@@ -39,4 +40,4 @@ public SecurityEvaluationContextExtension securityEvaluationContextExtension() {
3940
return new SecurityEvaluationContextExtension();
4041
}
4142

42-
}
43+
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfiguration.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.boot.autoconfigure.security;
1718

1819
import javax.servlet.Filter;
@@ -44,16 +45,17 @@
4445
@AutoConfigureAfter(SpringBootWebSecurityConfiguration.class)
4546
public class SecurityFilterAutoConfiguration {
4647

48+
private static final String DEFAULT_FILTER_NAME = AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME;
49+
4750
@Bean
48-
@ConditionalOnBean(name = AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME)
51+
@ConditionalOnBean(name = DEFAULT_FILTER_NAME)
4952
public FilterRegistrationBean securityFilterChainRegistration(
50-
@Qualifier(AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME) Filter securityFilter,
53+
@Qualifier(DEFAULT_FILTER_NAME) Filter securityFilter,
5154
SecurityProperties securityProperties) {
5255
FilterRegistrationBean registration = new FilterRegistrationBean(securityFilter);
5356
registration.setOrder(securityProperties.getFilterOrder());
54-
registration
55-
.setName(AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME);
57+
registration.setName(DEFAULT_FILTER_NAME);
5658
return registration;
5759
}
5860

59-
}
61+
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ public class SecurityProperties implements SecurityPrerequisite {
4040
* useful place to put user-defined access rules if you want to override the default
4141
* access rules.
4242
*/
43-
public static final int ACCESS_OVERRIDE_ORDER = SecurityProperties.BASIC_AUTH_ORDER
44-
- 2;
43+
public static final int ACCESS_OVERRIDE_ORDER = SecurityProperties.BASIC_AUTH_ORDER - 2;
4544

4645
/**
4746
* Order applied to the WebSecurityConfigurerAdapter that is used to configure basic
@@ -62,8 +61,7 @@ public class SecurityProperties implements SecurityPrerequisite {
6261
* other filters registered with the container). There is no connection between this
6362
* and the <code>@Order</code> on a WebSecurityConfigurer.
6463
*/
65-
public static final int DEFAULT_FILTER_ORDER = FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER
66-
- 100;
64+
public static final int DEFAULT_FILTER_ORDER = FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100;
6765

6866
/**
6967
* Enable secure channel for all requests.

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ConditionalOnEnabledResourceChain.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131
* @author Stephane Nicoll
3232
* @since 1.3.0
3333
*/
34-
@Target({ElementType.TYPE, ElementType.METHOD})
34+
@Target({ ElementType.TYPE, ElementType.METHOD })
3535
@Retention(RetentionPolicy.RUNTIME)
3636
@Documented
3737
@Conditional(OnEnabledResourceChainCondition.class)
3838
public @interface ConditionalOnEnabledResourceChain {
39+
3940
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/OnEnabledResourceChainCondition.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@
3434
class OnEnabledResourceChainCondition extends SpringBootCondition {
3535

3636
@Override
37-
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
38-
ConfigurableEnvironment environment = (ConfigurableEnvironment) context.getEnvironment();
39-
ResourceProperties resourceProperties = new ResourceProperties();
40-
RelaxedDataBinder binder = new RelaxedDataBinder(resourceProperties, "spring.resources");
37+
public ConditionOutcome getMatchOutcome(ConditionContext context,
38+
AnnotatedTypeMetadata metadata) {
39+
ConfigurableEnvironment environment = (ConfigurableEnvironment) context
40+
.getEnvironment();
41+
ResourceProperties properties = new ResourceProperties();
42+
RelaxedDataBinder binder = new RelaxedDataBinder(properties, "spring.resources");
4143
binder.bind(new PropertySourcesPropertyValues(environment.getPropertySources()));
42-
43-
Boolean match = resourceProperties.getChain().getEnabled();
44-
return new ConditionOutcome(match, "Resource chain is " + (match ? "enabled" : "disabled" + ")"));
44+
Boolean match = properties.getChain().getEnabled();
45+
return new ConditionOutcome(match, "Resource chain is "
46+
+ (match ? "enabled" : "disabled" + ")"));
4547
}
4648

4749
}

0 commit comments

Comments
 (0)