diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc index bc8b76e60d..4f0a9fef4f 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc @@ -8063,14 +8063,12 @@ If you require more control over Spring REST Docs configuration than offered by include::{code-examples}/test/autoconfigure/restdocs/webclient/AdvancedConfigurationExample.java[tag=configuration] ---- -If you want to make use of Spring REST Docs support for a parameterized output directory, you can create a `WebTestClientBuilderCustomizer` bean. -The auto-configuration calls this `WebTestClientBuilderCustomizer` in order to create the `WebTestClient` bean for the current context -with the consumer provided in the parameter of the method `entityExchangeResultConsumer`. -The following example shows a `WebTestClientBuilderCustomizer` being defined: +If you want to make use of Spring REST Docs support for a parameterized output directory, you can use a `WebTestClientBuilderCustomizer` to configure a consumer for every entity exchange result. +The following example shows such a `WebTestClientBuilderCustomizer` being defined: -[source,java,indent=0,subs="verbatim"] +[source,java,indent=0] ---- -include::{code-examples}/test/autoconfigure/restdocs/webclient/MyWebTestClientBuilderCustomizerConfiguration.java[] +include::{code-examples}/test/autoconfigure/restdocs/webclient/ParameterizedOutputConfigurationExample.java[tag=configuration] ---- diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/autoconfigure/restdocs/webclient/MyWebTestClientBuilderCustomizerConfiguration.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/autoconfigure/restdocs/webclient/ParameterizedOutputConfigurationExample.java similarity index 68% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/autoconfigure/restdocs/webclient/MyWebTestClientBuilderCustomizerConfiguration.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/autoconfigure/restdocs/webclient/ParameterizedOutputConfigurationExample.java index 8713104daa..9506765012 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/autoconfigure/restdocs/webclient/MyWebTestClientBuilderCustomizerConfiguration.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/autoconfigure/restdocs/webclient/ParameterizedOutputConfigurationExample.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.springbootapplications.autoconfiguredspringrestdocs.withwebtestclient; +package org.springframework.boot.docs.test.autoconfigure.restdocs.webclient; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.web.reactive.server.WebTestClientBuilderCustomizer; @@ -22,12 +22,18 @@ import org.springframework.context.annotation.Bean; import static org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation.document; -@TestConfiguration(proxyBeanMethods = false) -public class MyWebTestClientBuilderCustomizerConfiguration { +class ParameterizedOutputConfigurationExample { + + // tag::configuration[] + @TestConfiguration(proxyBeanMethods = false) + static class ParameterizedOutputConfiguration { + + @Bean + WebTestClientBuilderCustomizer restDocumentation() { + return (builder) -> builder.entityExchangeResultConsumer(document("{method-name}")); + } - @Bean - public WebTestClientBuilderCustomizer restDocumentation() { - return (builder) -> builder.entityExchangeResultConsumer(document("{method-name}")); } + // end::configuration[] }