Browse Source

Polish

Closes gh-11418
pull/11489/head
Johnny Lim 8 years ago committed by Stephane Nicoll
parent
commit
3c5ccb1166
  1. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryReactiveHealthEndpointWebExtension.java
  2. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryHealthEndpointWebExtension.java
  3. 4
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointMediaTypes.java
  4. 7
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java
  5. 11
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageHandlerMapping.java
  6. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java
  7. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigurationTests.java
  8. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java
  9. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageHandlerMappingTests.java
  10. 2
      spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/ConditionEvaluationDeltaLoggingListener.java
  11. 12
      spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
  12. 2
      spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc
  13. 2
      spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadataTests.java
  14. 2
      spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/StringSequenceTests.java

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryReactiveHealthEndpointWebExtension.java

@ -22,13 +22,12 @@ import org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryE
import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension; import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse; import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
import org.springframework.boot.actuate.endpoint.web.annotation.EndpointWebExtension;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthEndpoint; import org.springframework.boot.actuate.health.HealthEndpoint;
import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension; import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension;
/** /**
* Reactive {@link EndpointWebExtension} for the {@link HealthEndpoint} that always * Reactive {@link EndpointExtension} for the {@link HealthEndpoint} that always
* exposes full health details. * exposes full health details.
* *
* @author Madhura Bhave * @author Madhura Bhave

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryHealthEndpointWebExtension.java

@ -20,13 +20,12 @@ import org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryE
import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension; import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse; import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
import org.springframework.boot.actuate.endpoint.web.annotation.EndpointWebExtension;
import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthEndpoint; import org.springframework.boot.actuate.health.HealthEndpoint;
import org.springframework.boot.actuate.health.HealthEndpointWebExtension; import org.springframework.boot.actuate.health.HealthEndpointWebExtension;
/** /**
* {@link EndpointWebExtension} for the {@link HealthEndpoint} that always exposes full * {@link EndpointExtension} for the {@link HealthEndpoint} that always exposes full
* health details. * health details.
* *
* @author Madhura Bhave * @author Madhura Bhave

4
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/EndpointMediaTypes.java

@ -41,8 +41,8 @@ public class EndpointMediaTypes {
* @param consumed the default media types that are consumed by an endpoint. Must not * @param consumed the default media types that are consumed by an endpoint. Must not
*/ */
public EndpointMediaTypes(List<String> produced, List<String> consumed) { public EndpointMediaTypes(List<String> produced, List<String> consumed) {
Assert.notNull(produced, () -> "Produced must not be null"); Assert.notNull(produced, "Produced must not be null");
Assert.notNull(consumed, () -> "Consumed must not be null"); Assert.notNull(consumed, "Consumed must not be null");
this.produced = Collections.unmodifiableList(produced); this.produced = Collections.unmodifiableList(produced);
this.consumed = Collections.unmodifiableList(consumed); this.consumed = Collections.unmodifiableList(consumed);
} }

7
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java

@ -72,6 +72,8 @@ public class AutoConfigurationImportSelector
private static final Log logger = LogFactory private static final Log logger = LogFactory
.getLog(AutoConfigurationImportSelector.class); .getLog(AutoConfigurationImportSelector.class);
private static final String PROPERTY_NAME_AUTOCONFIGURE_EXCLUDE = "spring.autoconfigure.exclude";
private ConfigurableListableBeanFactory beanFactory; private ConfigurableListableBeanFactory beanFactory;
private Environment environment; private Environment environment;
@ -213,13 +215,12 @@ public class AutoConfigurationImportSelector
} }
private List<String> getExcludeAutoConfigurationsProperty() { private List<String> getExcludeAutoConfigurationsProperty() {
String name = "spring.autoconfigure.exclude";
if (getEnvironment() instanceof ConfigurableEnvironment) { if (getEnvironment() instanceof ConfigurableEnvironment) {
Binder binder = Binder.get(getEnvironment()); Binder binder = Binder.get(getEnvironment());
return binder.bind(name, String[].class).map(Arrays::asList) return binder.bind(PROPERTY_NAME_AUTOCONFIGURE_EXCLUDE, String[].class).map(Arrays::asList)
.orElse(Collections.emptyList()); .orElse(Collections.emptyList());
} }
String[] excludes = getEnvironment().getProperty(name, String[].class); String[] excludes = getEnvironment().getProperty(PROPERTY_NAME_AUTOCONFIGURE_EXCLUDE, String[].class);
return (excludes == null ? Collections.emptyList() : Arrays.asList(excludes)); return (excludes == null ? Collections.emptyList() : Arrays.asList(excludes));
} }

11
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageHandlerMapping.java

@ -16,6 +16,7 @@
package org.springframework.boot.autoconfigure.web.servlet; package org.springframework.boot.autoconfigure.web.servlet;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -35,7 +36,7 @@ import org.springframework.web.servlet.mvc.ParameterizableViewController;
/** /**
* An {@link AbstractUrlHandlerMapping} for an application's welcome page. Supports both * An {@link AbstractUrlHandlerMapping} for an application's welcome page. Supports both
* static and templated files. If both a static and templated index page is available, the * static and templated files. If both a static and templated index page are available, the
* static page is preferred. * static page is preferred.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
@ -45,6 +46,8 @@ final class WelcomePageHandlerMapping extends AbstractUrlHandlerMapping {
private static final Log logger = LogFactory.getLog(WelcomePageHandlerMapping.class); private static final Log logger = LogFactory.getLog(WelcomePageHandlerMapping.class);
private static final List<MediaType> MEDIA_TYPES_ALL = Collections.singletonList(MediaType.ALL);
WelcomePageHandlerMapping(TemplateAvailabilityProviders templateAvailabilityProviders, WelcomePageHandlerMapping(TemplateAvailabilityProviders templateAvailabilityProviders,
ApplicationContext applicationContext, Optional<Resource> welcomePage, ApplicationContext applicationContext, Optional<Resource> welcomePage,
String staticPathPattern) { String staticPathPattern) {
@ -85,8 +88,10 @@ final class WelcomePageHandlerMapping extends AbstractUrlHandlerMapping {
private List<MediaType> getAcceptedMediaTypes(HttpServletRequest request) { private List<MediaType> getAcceptedMediaTypes(HttpServletRequest request) {
String acceptHeader = request.getHeader(HttpHeaders.ACCEPT); String acceptHeader = request.getHeader(HttpHeaders.ACCEPT);
return MediaType.parseMediaTypes( if (StringUtils.hasText(acceptHeader)) {
StringUtils.hasText(acceptHeader) ? acceptHeader : "*/*"); return MediaType.parseMediaTypes(acceptHeader);
}
return MEDIA_TYPES_ALL;
} }
} }

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraRepositoriesAutoConfigurationTests.java

@ -96,7 +96,7 @@ public class CassandraRepositoriesAutoConfigurationTests {
} }
@Test @Test
public void enablingNoRepositoriesDisablesReactiveRepositories() { public void enablingNoRepositoriesDisablesImperativeRepositories() {
this.runner.withUserConfiguration(TestConfiguration.class) this.runner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.data.cassandra.repositories.type=none") .withPropertyValues("spring.data.cassandra.repositories.type=none")
.run((context) -> assertThat(context) .run((context) -> assertThat(context)

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfigurationTests.java

@ -97,7 +97,7 @@ public class MongoRepositoriesAutoConfigurationTests {
} }
@Test @Test
public void enablingNoRepositoriesDisablesReactiveRepositories() { public void enablingNoRepositoriesDisablesImperativeRepositories() {
this.runner.withUserConfiguration(TestConfiguration.class) this.runner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.data.mongodb.repositories.type=none") .withPropertyValues("spring.data.mongodb.repositories.type=none")
.run((context) -> assertThat(context) .run((context) -> assertThat(context)

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfigurationTests.java

@ -293,7 +293,7 @@ public class SecurityAutoConfigurationTests {
protected static class TestUserDetailsServiceConfiguration { protected static class TestUserDetailsServiceConfiguration {
@Bean @Bean
public InMemoryUserDetailsManager myUserDetailsService() { public InMemoryUserDetailsManager myUserDetailsManager() {
return new InMemoryUserDetailsManager( return new InMemoryUserDetailsManager(
User.withUsername("foo").password("bar").roles("USER").build()); User.withUsername("foo").password("bar").roles("USER").build());
} }

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

@ -75,7 +75,7 @@ public class WelcomePageHandlerMappingTests {
public void handlesRequestForStaticPageThatAcceptsAll() { public void handlesRequestForStaticPageThatAcceptsAll() {
this.contextRunner.withUserConfiguration(StaticResourceConfiguration.class) this.contextRunner.withUserConfiguration(StaticResourceConfiguration.class)
.run((context) -> MockMvcBuilders.webAppContextSetup(context).build() .run((context) -> MockMvcBuilders.webAppContextSetup(context).build()
.perform(get("/").accept("*/*")).andExpect(status().isOk()) .perform(get("/").accept(MediaType.ALL)).andExpect(status().isOk())
.andExpect(forwardedUrl("index.html"))); .andExpect(forwardedUrl("index.html")));
} }

2
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/ConditionEvaluationDeltaLoggingListener.java

@ -46,10 +46,12 @@ class ConditionEvaluationDeltaLoggingListener
if (!delta.getConditionAndOutcomesBySource().isEmpty() if (!delta.getConditionAndOutcomesBySource().isEmpty()
|| !delta.getExclusions().isEmpty() || !delta.getExclusions().isEmpty()
|| !delta.getUnconditionalClasses().isEmpty()) { || !delta.getUnconditionalClasses().isEmpty()) {
if (this.logger.isInfoEnabled()) {
this.logger.info("Condition evaluation delta:" this.logger.info("Condition evaluation delta:"
+ new ConditionEvaluationReportMessage(delta, + new ConditionEvaluationReportMessage(delta,
"CONDITION EVALUATION DELTA")); "CONDITION EVALUATION DELTA"));
} }
}
else { else {
this.logger.info("Condition evaluation unchanged"); this.logger.info("Condition evaluation unchanged");
} }

12
spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc

@ -1140,12 +1140,12 @@ content into your application. Rather, pick only the properties that you need.
management.endpoint.conditions.cache.time-to-live=0ms # Maximum time that a response can be cached. management.endpoint.conditions.cache.time-to-live=0ms # Maximum time that a response can be cached.
management.endpoint.conditions.enabled= # Whether to enable the conditions endpoint. management.endpoint.conditions.enabled= # Whether to enable the conditions endpoint.
# CONFIGURATION PROPERTIES REPORT ENDPOINT ({sc-spring-boot-actuator}/context/properties/ConfigurationPropertiesReportEndpoint.{sc-ext}[ConfigurationPropertiesReportEndpoint]) # CONFIGURATION PROPERTIES REPORT ENDPOINT ({sc-spring-boot-actuator}/context/properties/ConfigurationPropertiesReportEndpoint.{sc-ext}[ConfigurationPropertiesReportEndpoint], {sc-spring-boot-actuator-autoconfigure}/context/properties/ConfigurationPropertiesReportEndpointProperties.{sc-ext}[ConfigurationPropertiesReportEndpointProperties])
management.endpoint.configprops.cache.time-to-live=0ms # Maximum time that a response can be cached. management.endpoint.configprops.cache.time-to-live=0ms # Maximum time that a response can be cached.
management.endpoint.configprops.enabled= # Whether to enable the configprops endpoint. management.endpoint.configprops.enabled= # Whether to enable the configprops endpoint.
management.endpoint.configprops.keys-to-sanitize=password,secret,key,token,.*credentials.*,vcap_services # Keys that should be sanitized. Keys can be simple strings that the property ends with or regular expressions. management.endpoint.configprops.keys-to-sanitize=password,secret,key,token,.*credentials.*,vcap_services # Keys that should be sanitized. Keys can be simple strings that the property ends with or regular expressions.
# ENVIRONMENT ENDPOINT ({sc-spring-boot-actuator}/env/EnvironmentEndpoint.{sc-ext}[EnvironmentEndpoint]) # ENVIRONMENT ENDPOINT ({sc-spring-boot-actuator}/env/EnvironmentEndpoint.{sc-ext}[EnvironmentEndpoint], {sc-spring-boot-actuator-autoconfigure}/env/EnvironmentEndpointProperties.{sc-ext}[EnvironmentEndpointProperties])
management.endpoint.env.cache.time-to-live=0ms # Maximum time that a response can be cached. management.endpoint.env.cache.time-to-live=0ms # Maximum time that a response can be cached.
management.endpoint.env.enabled= # Whether to enable the env endpoint. management.endpoint.env.enabled= # Whether to enable the env endpoint.
management.endpoint.env.keys-to-sanitize=password,secret,key,token,.*credentials.*,vcap_services # Keys that should be sanitized. Keys can be simple strings that the property ends with or regular expressions. management.endpoint.env.keys-to-sanitize=password,secret,key,token,.*credentials.*,vcap_services # Keys that should be sanitized. Keys can be simple strings that the property ends with or regular expressions.
@ -1154,10 +1154,10 @@ content into your application. Rather, pick only the properties that you need.
management.endpoint.flyway.cache.time-to-live=0ms # Maximum time that a response can be cached. management.endpoint.flyway.cache.time-to-live=0ms # Maximum time that a response can be cached.
management.endpoint.flyway.enabled= # Whether to enable the flyway endpoint. management.endpoint.flyway.enabled= # Whether to enable the flyway endpoint.
# HEALTH ENDPOINT ({sc-spring-boot-actuator}/health/HealthEndpoint.{sc-ext}[HealthEndpoint]) # HEALTH ENDPOINT ({sc-spring-boot-actuator}/health/HealthEndpoint.{sc-ext}[HealthEndpoint], {sc-spring-boot-actuator-autoconfigure}/health/HealthEndpointProperties.{sc-ext}[HealthEndpointProperties])
management.endpoint.health.cache.time-to-live=0ms # Maximum time that a response can be cached. management.endpoint.health.cache.time-to-live=0ms # Maximum time that a response can be cached.
management.endpoint.health.enabled= # Whether to enable the health endpoint. management.endpoint.health.enabled= # Whether to enable the health endpoint.
management.endpoint.health.show-details= # Whether to show full health details management.endpoint.health.show-details=false # Whether to show full health details instead of just the status when exposed over a potentially insecure connection.
# HEAP DUMP ENDPOINT ({sc-spring-boot-actuator}/management/HeapDumpWebEndpoint.{sc-ext}[HeapDumpWebEndpoint]) # HEAP DUMP ENDPOINT ({sc-spring-boot-actuator}/management/HeapDumpWebEndpoint.{sc-ext}[HeapDumpWebEndpoint])
management.endpoint.heapdump.cache.time-to-live=0ms # Maximum time that a response can be cached. management.endpoint.heapdump.cache.time-to-live=0ms # Maximum time that a response can be cached.
@ -1171,7 +1171,7 @@ content into your application. Rather, pick only the properties that you need.
management.endpoint.liquibase.cache.time-to-live=0ms # Maximum time that a response can be cached. management.endpoint.liquibase.cache.time-to-live=0ms # Maximum time that a response can be cached.
management.endpoint.liquibase.enabled= # Whether to enable the liquibase endpoint. management.endpoint.liquibase.enabled= # Whether to enable the liquibase endpoint.
# LOG FILE ENDPOINT ({sc-spring-boot-actuator}/logging/LogFileWebEndpoint.{sc-ext}[LogFileWebEndpoint]) # LOG FILE ENDPOINT ({sc-spring-boot-actuator}/logging/LogFileWebEndpoint.{sc-ext}[LogFileWebEndpoint], {sc-spring-boot-actuator-autoconfigure}/logging/LogFileWebEndpointProperties.{sc-ext}[LogFileWebEndpointProperties])
management.endpoint.logfile.cache.time-to-live=0ms # Maximum time that a response can be cached. management.endpoint.logfile.cache.time-to-live=0ms # Maximum time that a response can be cached.
management.endpoint.logfile.enabled= # Whether to enable the logfile endpoint. management.endpoint.logfile.enabled= # Whether to enable the logfile endpoint.
management.endpoint.logfile.external-file= # External Logfile to be accessed. Can be used if the logfile is written by output redirect and not by the logging system itself. management.endpoint.logfile.external-file= # External Logfile to be accessed. Can be used if the logfile is written by output redirect and not by the logging system itself.
@ -1223,8 +1223,8 @@ content into your application. Rather, pick only the properties that you need.
management.health.elasticsearch.enabled=true # Whether to enable Elasticsearch health check. management.health.elasticsearch.enabled=true # Whether to enable Elasticsearch health check.
management.health.elasticsearch.indices= # Comma-separated index names. management.health.elasticsearch.indices= # Comma-separated index names.
management.health.elasticsearch.response-timeout=100ms # The time to wait for a response from the cluster. management.health.elasticsearch.response-timeout=100ms # The time to wait for a response from the cluster.
management.health.jms.enabled=true # Whether to enable JMS health check.
management.health.influxdb.enabled=true # Whether to enable InfluxDB health check. management.health.influxdb.enabled=true # Whether to enable InfluxDB health check.
management.health.jms.enabled=true # Whether to enable JMS health check.
management.health.ldap.enabled=true # Whether to enable LDAP health check. management.health.ldap.enabled=true # Whether to enable LDAP health check.
management.health.mail.enabled=true # Whether to enable Mail health check. management.health.mail.enabled=true # Whether to enable Mail health check.
management.health.mongo.enabled=true # Whether to enable MongoDB health check. management.health.mongo.enabled=true # Whether to enable MongoDB health check.

2
spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc

@ -2270,7 +2270,7 @@ it switches off the default webapp security settings in Spring Boot.
=== Change the AuthenticationManager and Add User Accounts === Change the AuthenticationManager and Add User Accounts
If you provide a `@Bean` of type `AuthenticationManager`, `AuthenticationProvider` If you provide a `@Bean` of type `AuthenticationManager`, `AuthenticationProvider`
or `UserDetailsService`, the default `@Bean` for `InMemoryUserDetailsManager` is not or `UserDetailsService`, the default `@Bean` for `InMemoryUserDetailsManager` is not
created, so you have the full feature set of Spring Security available (such as created. So you have the full feature set of Spring Security available (such as
http://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#jc-authentication[various authentication options]). http://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#jc-authentication[various authentication options]).
The easiest way to add user accounts is to provide your own `UserDetailsService` bean. The easiest way to add user accounts is to provide your own `UserDetailsService` bean.

2
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadataTests.java

@ -28,7 +28,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ItemMetadataTests { public class ItemMetadataTests {
@Test @Test
public void newItemMetadataPrefixWithUpperCasePrefix() { public void newItemMetadataPrefixWithCapitalizedPrefix() {
assertThat(newItemMetadataPrefix("Prefix.", "value")).isEqualTo("prefix.value"); assertThat(newItemMetadataPrefix("Prefix.", "value")).isEqualTo("prefix.value");
} }

2
spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/StringSequenceTests.java

@ -59,7 +59,7 @@ public class StringSequenceTests {
} }
@Test @Test
public void creatFromString() { public void createFromString() {
assertThat(new StringSequence("test").toString()).isEqualTo("test"); assertThat(new StringSequence("test").toString()).isEqualTo("test");
} }

Loading…
Cancel
Save