diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurer.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurer.java index a0f1a0d10b..b5e992f7be 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurer.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurer.java @@ -25,13 +25,12 @@ import io.micrometer.core.instrument.binder.MeterBinder; import io.micrometer.core.instrument.composite.CompositeMeterRegistry; import io.micrometer.core.instrument.config.MeterFilter; -import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.boot.util.LambdaSafe; /** - * {@link BeanPostProcessor} to apply {@link MeterRegistryCustomizer customizers}, + * Configurer to apply {@link MeterRegistryCustomizer customizers}, * {@link MeterFilter filters}, {@link MeterBinder binders} and {@link Metrics#addRegistry - * global registration} to {@link MeterRegistry meter registries}. This post processor + * global registration} to {@link MeterRegistry meter registries}. This configurer * intentionally skips {@link CompositeMeterRegistry} with the assumptions that the * registries it contains are beans and will be customized directly. * diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebFluxMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebFluxMetricsAutoConfiguration.java index 4d80d9fa1f..6f619440d9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebFluxMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/reactive/WebFluxMetricsAutoConfiguration.java @@ -34,7 +34,7 @@ import org.springframework.context.annotation.Configuration; /** * {@link EnableAutoConfiguration Auto-configuration} for instrumentation of Spring - * Webflux MVC annotation-based programming model request mappings. + * WebFlux MVC annotation-based programming model request mappings. * * @author Jon Schneider * @since 2.0.0 diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryCustomizerTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryCustomizerTests.java index 4aebdd4f15..f28198c46b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryCustomizerTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryCustomizerTests.java @@ -85,7 +85,7 @@ public class MeterRegistryCustomizerTests { } @Bean - public MeterRegistryCustomizer prometehusOnlyCommonTags() { + public MeterRegistryCustomizer prometheusOnlyCommonTags() { return (registry) -> registry.config().commonTags("job", "myjob"); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfigurationTests.java index db8f944c73..d2b915d897 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfigurationTests.java @@ -80,9 +80,7 @@ public class NewRelicMetricsExportAutoConfigurationTests { @Test public void autoConfigurationCanBeDisabled() { this.contextRunner.withUserConfiguration(BaseConfiguration.class) - .withPropertyValues("management.metrics.export.newrelic.enabled=false", - "management.metrics.export.newrelic.api-key=abcde", - "management.metrics.export.newrelic.account-id=12345") + .withPropertyValues("management.metrics.export.newrelic.enabled=false") .run((context) -> assertThat(context) .doesNotHaveBean(NewRelicMeterRegistry.class) .doesNotHaveBean(NewRelicConfig.class)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfigurationTests.java index e2ff14fd76..a998f25483 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/signalfx/SignalFxMetricsExportAutoConfigurationTests.java @@ -72,7 +72,6 @@ public class SignalFxMetricsExportAutoConfigurationTests { public void autoConfigurationCanBeDisabled() { this.contextRunner.withUserConfiguration(BaseConfiguration.class) .withPropertyValues( - "management.metrics.export.signalfx.access-token=abcde", "management.metrics.export.signalfx.enabled=false") .run((context) -> assertThat(context) .doesNotHaveBean(SignalFxMeterRegistry.class) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java index d951e3497b..585d432b46 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthIndicator.java @@ -50,7 +50,7 @@ public abstract class AbstractHealthIndicator implements HealthIndicator { * Create a new {@link AbstractHealthIndicator} instance with a default * {@code healthCheckFailedMessage}. */ - public AbstractHealthIndicator() { + protected AbstractHealthIndicator() { this(NO_MESSAGE); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java index a158f4205b..fad2e70347 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilter.java @@ -30,7 +30,7 @@ import org.springframework.web.server.WebFilter; import org.springframework.web.server.WebFilterChain; /** - * Intercepts incoming HTTP requests modeled with the Webflux annotation-based programming + * Intercepts incoming HTTP requests modeled with the WebFlux annotation-based programming * model. * * @author Jon Schneider diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index 12633f9281..dbabec7356 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -551,7 +551,7 @@ JMX or an HTTP request is converted to the required types using an instance of [[production-ready-endpoints-custom-web]] ==== Custom Web Endpoints -Operations on a `@Endpoint`, `@WebEndpoint`, or `@WebEndpointExtension` are automatically +Operations on an `@Endpoint`, `@WebEndpoint`, or `@WebEndpointExtension` are automatically exposed over HTTP using Jersey, Spring MVC, or Spring WebFlux. @@ -673,7 +673,7 @@ possible. ==== Controller endpoints `@ControllerEndpoint` and `@RestControllerEndpoint` can be used to implement an endpoint that is only exposed by Spring MVC or Spring WebFlux. Methods are mapped using the -standard annotations Spring MVC and Spring WebFlux annotations such as `@RequestMapping` +standard annotations for Spring MVC and Spring WebFlux such as `@RequestMapping` and `@GetMapping`, with the endpoint's ID being used as a prefix for the path. Controller endpoints provide deeper integration with Spring's web frameworks but at the expense of portability. The `@Endpoint` and `@WebEndpoint` annotations should be preferred whenever @@ -1763,8 +1763,8 @@ is required. A `CacheMetricsRegistrar` bean is made available to make that proce [[production-ready-metrics-jdbc]] ==== DataSource Metrics -Auto-configuration enables the instrumentation of all available DataSource` objects with a -metric named `jdbc`. Data source instrumentation results in gauges representing the +Auto-configuration enables the instrumentation of all available `DataSource` objects with +a metric named `jdbc`. Data source instrumentation results in gauges representing the currently active, maximum allowed, and minimum allowed connections in the pool. Each of these gauges has a name that is prefixed by `jdbc`. diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/CustomWebFluxSecurityExample.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/CustomWebFluxSecurityExample.java index 852c54bbb7..7ee3ac5ee0 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/CustomWebFluxSecurityExample.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/CustomWebFluxSecurityExample.java @@ -18,7 +18,6 @@ package org.springframework.boot.docs.web.security; import org.springframework.boot.autoconfigure.security.reactive.PathRequest; import org.springframework.context.annotation.Bean; -import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.web.server.SecurityWebFilterChain; @@ -27,20 +26,19 @@ import org.springframework.security.web.server.SecurityWebFilterChain; * * @author Madhura Bhave */ -@EnableWebFluxSecurity public class CustomWebFluxSecurityExample { // @formatter:off // tag::configuration[] @Bean public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { - http + return http .authorizeExchange() .matchers(PathRequest.toStaticResources().atCommonLocations()).permitAll() .pathMatchers("/foo", "/bar") .authenticated().and() - .formLogin(); - return http.build(); + .formLogin().and() + .build(); } // end::configuration[] // @formatter:on diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebTestClientSpringBootTestIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebTestClientSpringBootTestIntegrationTests.java index d2696e3f75..5a703b1e5c 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebTestClientSpringBootTestIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebTestClientSpringBootTestIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,8 +74,7 @@ public class WebTestClientSpringBootTestIntegrationTests { @Bean public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { - http.authorizeExchange().anyExchange().permitAll(); - return http.build(); + return http.authorizeExchange().anyExchange().permitAll().and().build(); } } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java index 7105917486..92f51b045b 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java @@ -110,7 +110,7 @@ public class ApplicationContextAssert * Verifies that the application context contains a single bean with the given type. *

* Example:

-	 * assertThat(context).hasSingleBean(Foo.class); 
+ * assertThat(context).hasSingleBean(Foo.class, Scope.NO_ANCESTORS); * @param type the bean type * @param scope the scope of the assertion * @return {@code this} assertion object. @@ -159,7 +159,7 @@ public class ApplicationContextAssert * Verifies that the application context does not contain any beans of the given type. *

* Example:

-	 * assertThat(context).doesNotHaveBean(Foo.class); 
+ * assertThat(context).doesNotHaveBean(Foo.class, Scope.NO_ANCESTORS); * @param type the bean type * @param scope the scope of the assertion * @return {@code this} assertion object. @@ -255,8 +255,8 @@ public class ApplicationContextAssert * assert on {@code null} is returned. *

* Example:

-	 * assertThat(context).getBean(Foo.class).isInstanceOf(DefaultFoo.class);
-	 * assertThat(context).getBean(Bar.class).isNull();
+ * assertThat(context).getBean(Foo.class, Scope.NO_ANCESTORS).isInstanceOf(DefaultFoo.class); + * assertThat(context).getBean(Bar.class, Scope.NO_ANCESTORS).isNull(); * @param the bean type * @param type the bean type * @param scope the scope of the assertion @@ -374,7 +374,7 @@ public class ApplicationContextAssert * can be found an assert on an empty {@code map} is returned. *

* Example:

-	 * assertThat(context).getBeans(Foo.class).containsKey("foo");
+	 * assertThat(context).getBeans(Foo.class, Scope.NO_ANCESTORS).containsKey("foo");
 	 * 
* @param the bean type * @param type the bean type diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java index 74e915230d..a1c177ae6d 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java @@ -142,7 +142,7 @@ public class TestRestTemplateTests { .willReturn(new DefaultUriBuilderFactory()); RestTemplateBuilder builder = mock(RestTemplateBuilder.class); given(builder.build()).willReturn(delegate); - final TestRestTemplate restTemplate = new TestRestTemplate(builder); + TestRestTemplate restTemplate = new TestRestTemplate(builder); ReflectionUtils.doWithMethods(RestOperations.class, new MethodCallback() { @Override diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesTests.java index 1feaaaf079..9466f99fee 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesTests.java @@ -60,7 +60,6 @@ public class ConfigurationPropertySourcesTests { public void attachShouldReAttachInMergedSetup() { ConfigurableEnvironment parent = new StandardEnvironment(); ConfigurationPropertySources.attach(parent); - parent.getProperty("my.example-property"); ConfigurableEnvironment child = new StandardEnvironment(); child.merge(parent); child.getPropertySources().addLast(new MapPropertySource("config", diff --git a/spring-boot-samples/README.adoc b/spring-boot-samples/README.adoc index c2d27ec1ad..3cefc23622 100644 --- a/spring-boot-samples/README.adoc +++ b/spring-boot-samples/README.adoc @@ -120,7 +120,7 @@ The following sample applications are provided: | Demonstrates JUnit Jupiter-based testing | link:spring-boot-sample-kafka[spring-boot-sample-kafka] -| consumer and producer using Apache Kafka +| Consumer and producer using Apache Kafka | link:spring-boot-sample-liquibase[spring-boot-sample-liquibase] | Database migrations with Liquibase diff --git a/spring-boot-samples/spring-boot-sample-kafka/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-kafka/src/main/resources/application.properties index 97dbed42b9..179587112b 100644 --- a/spring-boot-samples/spring-boot-sample-kafka/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-kafka/src/main/resources/application.properties @@ -2,5 +2,5 @@ spring.kafka.bootstrap-servers=localhost:9092 spring.kafka.consumer.group-id=testGroup spring.kafka.consumer.auto-offset-reset=earliest spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer -spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer -spring.kafka.consumer.properties.spring.json.trusted.packages=sample.kafka \ No newline at end of file +spring.kafka.consumer.properties.spring.json.trusted.packages=sample.kafka +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-secure-webflux/src/test/java/sample/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java b/spring-boot-samples/spring-boot-sample-secure-webflux/src/test/java/sample/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java index b99971fccf..4d2796a0de 100644 --- a/spring-boot-samples/spring-boot-sample-secure-webflux/src/test/java/sample/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java +++ b/spring-boot-samples/spring-boot-sample-secure-webflux/src/test/java/sample/secure/webflux/SampleSecureWebFluxCustomSecurityTests.java @@ -116,15 +116,14 @@ public class SampleSecureWebFluxCustomSecurityTests { @Bean public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { - http.authorizeExchange().matchers(EndpointRequest.to("health", "info")) + return http.authorizeExchange().matchers(EndpointRequest.to("health", "info")) .permitAll() .matchers(EndpointRequest.toAnyEndpoint() .excluding(MappingsEndpoint.class)) .hasRole("ACTUATOR") .matchers(PathRequest.toStaticResources().atCommonLocations()) .permitAll().pathMatchers("/login").permitAll().anyExchange() - .authenticated().and().httpBasic(); - return http.build(); + .authenticated().and().httpBasic().and().build(); } }