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 9d2b07d22246..6a41a86032d9 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 @@ -7206,7 +7206,7 @@ It can also be used to configure the host, scheme, and port that appears in any [[boot-features-testing-spring-boot-applications-testing-autoconfigured-rest-docs-mock-mvc]] ===== Auto-configured Spring REST Docs Tests with Mock MVC -`@AutoConfigureRestDocs` customizes the `MockMvc` bean to use Spring REST Docs. +`@AutoConfigureRestDocs` customizes the `MockMvc` bean to use Spring REST Docs when testing Servlet-based web applications. You can inject it by using `@Autowired` and use it in your tests as you normally would when using Mock MVC and Spring REST Docs, as shown in the following example: [source,java,indent=0] @@ -7276,7 +7276,7 @@ The following example shows a `RestDocumentationResultHandler` being defined: [[boot-features-testing-spring-boot-applications-testing-autoconfigured-rest-docs-web-test-client]] ===== Auto-configured Spring REST Docs Tests with WebTestClient -`@AutoConfigureRestDocs` can also be used with `WebTestClient`. +`@AutoConfigureRestDocs` can also be used with `WebTestClient` when testing reactive web applications. You can inject it by using `@Autowired` and use it in your tests as you normally would when using `@WebFluxTest` and Spring REST Docs, as shown in the following example: [source,java,indent=0] diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/AutoConfigureRestDocs.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/AutoConfigureRestDocs.java index 95625f15cbb0..d4ec51fbc022 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/AutoConfigureRestDocs.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/AutoConfigureRestDocs.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -23,16 +23,25 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import io.restassured.RestAssured; + import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.test.autoconfigure.properties.PropertyMapping; import org.springframework.context.annotation.Import; import org.springframework.core.annotation.AliasFor; +import org.springframework.test.web.reactive.server.WebTestClient; +import org.springframework.test.web.servlet.MockMvc; /** * Annotation that can be applied to a test class to enable and configure - * auto-configuration of Spring REST Docs. Allows configuration of the output directory - * and the host, scheme, and port of generated URIs. When further configuration is - * required a {@link RestDocsMockMvcConfigurationCustomizer} bean can be used. + * auto-configuration of Spring REST Docs. The auto-configuration sets up + * {@link MockMvc}-based testing of a servlet web application, {@link WebTestClient}-based + * testing of a reactive web application, or {@link RestAssured}-based testing of any web + * application over HTTP. + *

+ * Allows configuration of the output directory and the host, scheme, and port of + * generated URIs. When further configuration is required a + * {@link RestDocsMockMvcConfigurationCustomizer} bean can be used. * * @author Andy Wilkinson * @since 1.4.0