Skip to content

Commit 9044b5a

Browse files
committed
Merge pull request #11193 from izeye:polish-20171129
* pr/11193: Polish
2 parents 33bd7cc + 952224e commit 9044b5a

File tree

9 files changed

+36
-37
lines changed

9 files changed

+36
-37
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/jersey/JerseyWebEndpointManagementContextConfiguration.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
*
4242
* @author Andy Wilkinson
4343
* @author Phillip Webb
44-
* @since 2.0.0
4544
*/
4645
@Configuration
4746
@ConditionalOnWebApplication(type = Type.SERVLET)

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void dataSourceInstrumentationCanBeDisabled() {
8686
.run((context) -> {
8787
context.getBean(DataSource.class).getConnection().getMetaData();
8888
MeterRegistry registry = context.getBean(MeterRegistry.class);
89-
assertThat(registry.find("custom.name.max.connections")
89+
assertThat(registry.find("data.source.max.connections")
9090
.tags("name", "dataSource").meter()).isNotPresent();
9191
});
9292
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public String[] selectImports(AnnotationMetadata importingClassMetadata) {
153153
* Base class for beans used to validate that only one supported implementation is
154154
* available in the classpath when the store-type property is not set.
155155
*/
156-
static class AbstractSessionRepositoryImplementationValidator {
156+
static abstract class AbstractSessionRepositoryImplementationValidator {
157157

158158
private final List<String> candidates;
159159

@@ -233,7 +233,7 @@ static class ReactiveSessionRepositoryImplementationValidator
233233
/**
234234
* Base class for validating that a (reactive) session repository bean exists.
235235
*/
236-
static class AbstractSessionRepositoryValidator {
236+
static abstract class AbstractSessionRepositoryValidator {
237237

238238
private final SessionProperties sessionProperties;
239239

@@ -276,7 +276,7 @@ static class ServletSessionRepositoryValidator
276276
}
277277

278278
/**
279-
* Bean used to validate that a {@link SessionRepository} exists and provide a
279+
* Bean used to validate that a {@link ReactiveSessionRepository} exists and provide a
280280
* meaningful message if that's not the case.
281281
*/
282282
static class ReactiveSessionRepositoryValidator

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,14 @@ public void customTomcatAcceptCount() {
350350
bindProperties(map);
351351
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
352352
this.customizer.customize(factory);
353-
TomcatWebServer embeddedFactory = (TomcatWebServer) factory.getWebServer();
354-
embeddedFactory.start();
353+
TomcatWebServer server = (TomcatWebServer) factory.getWebServer();
354+
server.start();
355355
try {
356-
assertThat(((AbstractProtocol<?>) embeddedFactory.getTomcat().getConnector()
356+
assertThat(((AbstractProtocol<?>) server.getTomcat().getConnector()
357357
.getProtocolHandler()).getAcceptCount()).isEqualTo(10);
358358
}
359359
finally {
360-
embeddedFactory.stop();
360+
server.stop();
361361
}
362362
}
363363

@@ -368,14 +368,14 @@ public void customTomcatMaxConnections() {
368368
bindProperties(map);
369369
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
370370
this.customizer.customize(factory);
371-
TomcatWebServer embeddedFactory = (TomcatWebServer) factory.getWebServer();
372-
embeddedFactory.start();
371+
TomcatWebServer server = (TomcatWebServer) factory.getWebServer();
372+
server.start();
373373
try {
374-
assertThat(((AbstractProtocol<?>) embeddedFactory.getTomcat().getConnector()
374+
assertThat(((AbstractProtocol<?>) server.getTomcat().getConnector()
375375
.getProtocolHandler()).getMaxConnections()).isEqualTo(5);
376376
}
377377
finally {
378-
embeddedFactory.stop();
378+
server.stop();
379379
}
380380
}
381381

@@ -386,14 +386,14 @@ public void customTomcatMaxHttpPostSize() {
386386
bindProperties(map);
387387
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
388388
this.customizer.customize(factory);
389-
TomcatWebServer embeddedFactory = (TomcatWebServer) factory.getWebServer();
390-
embeddedFactory.start();
389+
TomcatWebServer server = (TomcatWebServer) factory.getWebServer();
390+
server.start();
391391
try {
392-
assertThat(embeddedFactory.getTomcat().getConnector().getMaxPostSize())
392+
assertThat(server.getTomcat().getConnector().getMaxPostSize())
393393
.isEqualTo(10000);
394394
}
395395
finally {
396-
embeddedFactory.stop();
396+
server.stop();
397397
}
398398
}
399399

@@ -404,14 +404,14 @@ public void customTomcatDisableMaxHttpPostSize() {
404404
bindProperties(map);
405405
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
406406
this.customizer.customize(factory);
407-
TomcatWebServer embeddedFactory = (TomcatWebServer) factory.getWebServer();
408-
embeddedFactory.start();
407+
TomcatWebServer server = (TomcatWebServer) factory.getWebServer();
408+
server.start();
409409
try {
410-
assertThat(embeddedFactory.getTomcat().getConnector().getMaxPostSize())
410+
assertThat(server.getTomcat().getConnector().getMaxPostSize())
411411
.isEqualTo(-1);
412412
}
413413
finally {
414-
embeddedFactory.stop();
414+
server.stop();
415415
}
416416
}
417417

@@ -611,15 +611,15 @@ public void customTomcatStaticResourceCacheTtl() {
611611
bindProperties(map);
612612
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
613613
this.customizer.customize(factory);
614-
TomcatWebServer embeddedFactory = (TomcatWebServer) factory.getWebServer();
615-
embeddedFactory.start();
614+
TomcatWebServer server = (TomcatWebServer) factory.getWebServer();
615+
server.start();
616616
try {
617-
Tomcat tomcat = embeddedFactory.getTomcat();
617+
Tomcat tomcat = server.getTomcat();
618618
Context context = (Context) tomcat.getHost().findChildren()[0];
619619
assertThat(context.getResources().getCacheTtl()).isEqualTo(10000L);
620620
}
621621
finally {
622-
embeddedFactory.stop();
622+
server.stop();
623623
}
624624
}
625625

spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ following information:
10151015

10161016
[[production-ready-metrics-jdbc]]
10171017
=== DataSource metrics
1018-
Auto-configuration will enable the instrumentation of all available `DataSources` with a
1018+
Auto-configuration will enable the instrumentation of all available ``DataSource``s with a
10191019
metric named `data.source`. Data source instrumentation results in gauges representing
10201020
the currently active, maximum allowed, and minimum allowed connections in the pool. Each
10211021
of these gauges has a name which is prefixed by `data.source` by default. The prefix can

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebApplicationContext.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
/**
3939
* {@link ConfigurableReactiveWebApplicationContext} that accepts annotated classes as
4040
* input - in particular
41-
* {@link org.springframework.context.annotation.Configuration @Configuration} -annotated
41+
* {@link org.springframework.context.annotation.Configuration @Configuration}-annotated
4242
* classes, but also plain {@link Component @Component} classes and JSR-330 compliant
4343
* classes using {@code javax.inject} annotations. Allows for registering classes one by
4444
* one (specifying class names as config location) as well as for classpath scanning
@@ -311,7 +311,6 @@ protected AnnotatedBeanDefinitionReader getAnnotatedBeanDefinitionReader(
311311
* with a {@code BeanNameGenerator} or {@code ScopeMetadataResolver} yet.
312312
* @param beanFactory the bean factory to load bean definitions into
313313
* @return the class path bean definition scanner
314-
* @since 4.1.9
315314
* @see #getEnvironment()
316315
* @see #getBeanNameGenerator()
317316
* @see #getScopeMetadataResolver()

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/context/AnnotationConfigReactiveWebServerApplicationContext.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
import org.springframework.core.env.ConfigurableEnvironment;
2929
import org.springframework.stereotype.Component;
3030
import org.springframework.util.Assert;
31+
import org.springframework.util.ObjectUtils;
3132

3233
/**
3334
* {@link ReactiveWebServerApplicationContext} that accepts annotated classes as input -
3435
* in particular
35-
* {@link org.springframework.context.annotation.Configuration @Configuration} -annotated
36+
* {@link org.springframework.context.annotation.Configuration @Configuration}-annotated
3637
* classes, but also plain {@link Component @Component} classes and JSR-330 compliant
3738
* classes using {@code javax.inject} annotations. Allows for registering classes one by
3839
* one (specifying class names as config location) as well as for classpath scanning
@@ -124,8 +125,8 @@ public void setEnvironment(ConfigurableEnvironment environment) {
124125

125126
/**
126127
* Provide a custom {@link BeanNameGenerator} for use with
127-
* {@link AnnotatedBeanDefinitionReader} and/or {@link ClassPathBeanDefinitionScanner}
128-
* , if any.
128+
* {@link AnnotatedBeanDefinitionReader} and/or {@link ClassPathBeanDefinitionScanner},
129+
* if any.
129130
* <p>
130131
* Default is
131132
* {@link org.springframework.context.annotation.AnnotationBeanNameGenerator}.
@@ -197,10 +198,10 @@ protected void prepareRefresh() {
197198
@Override
198199
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
199200
super.postProcessBeanFactory(beanFactory);
200-
if (this.basePackages != null && this.basePackages.length > 0) {
201+
if (!ObjectUtils.isEmpty(this.basePackages)) {
201202
this.scanner.scan(this.basePackages);
202203
}
203-
if (this.annotatedClasses != null && this.annotatedClasses.length > 0) {
204+
if (!ObjectUtils.isEmpty(this.annotatedClasses)) {
204205
this.reader.register(this.annotatedClasses);
205206
}
206207
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebServerApplicationContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ public void setEnvironment(ConfigurableEnvironment environment) {
122122

123123
/**
124124
* Provide a custom {@link BeanNameGenerator} for use with
125-
* {@link AnnotatedBeanDefinitionReader} and/or {@link ClassPathBeanDefinitionScanner}
126-
* , if any.
125+
* {@link AnnotatedBeanDefinitionReader} and/or {@link ClassPathBeanDefinitionScanner},
126+
* if any.
127127
* <p>
128128
* Default is
129129
* {@link org.springframework.context.annotation.AnnotationBeanNameGenerator}.

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesBinderBuilderTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public void useCustomValidator() {
101101

102102
@Test
103103
public void detectDefaultValidator() {
104-
this.applicationContext.registerSingleton("configurationPropertiesValidator",
104+
this.applicationContext.registerSingleton(ConfigurationPropertiesBindingPostProcessor.VALIDATOR_BEAN_NAME,
105105
LocalValidatorFactoryBean.class);
106106
ConfigurationPropertiesBinder binder = this.builder
107107
.withEnvironment(this.environment).build();
108108
assertThat(ReflectionTestUtils.getField(binder, "validator")).isSameAs(
109-
this.applicationContext.getBean("configurationPropertiesValidator"));
109+
this.applicationContext.getBean(ConfigurationPropertiesBindingPostProcessor.VALIDATOR_BEAN_NAME));
110110
}
111111

112112
@Test

0 commit comments

Comments
 (0)