diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index d42572c368..bb3918adb8 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -6017,9 +6017,9 @@ A list of the auto-configuration that is enabled by `@JsonTest` can be ==== Auto-configured Spring MVC Tests To test Spring MVC controllers are working as expected, you can use the `@WebMvcTest` annotation. `@WebMvcTest` auto-configures the Spring MVC infrastructure and limits -scanned beans to `@Controller`, `@ControllerAdvice`, `@JsonComponent`, `Converter`, `GenericConverter`, -`Filter`, `WebMvcConfigurer`, and `HandlerMethodArgumentResolver`. Regular `@Component` -beans are not scanned when using this annotation. +scanned beans to `@Controller`, `@ControllerAdvice`, `@JsonComponent`, `Converter`, +`GenericConverter`, `Filter`, `WebMvcConfigurer`, and `HandlerMethodArgumentResolver`. +Regular `@Component` beans are not scanned when using this annotation. TIP: If you need to register extra components such as Jackson `Module`, you can import additional configuration classes using `@Import` on your test. @@ -6124,8 +6124,8 @@ A list of the auto-configuration settings that are enabled by `@WebMvcTest` can To test that Spring WebFlux controllers are working as expected, you can use the `@WebFluxTest` annotation. `@WebFluxTest` auto-configures the Spring WebFlux infrastructure and limits scanned beans to `@Controller`, `@ControllerAdvice`, -`@JsonComponent`, `Converter`, `GenericConverter`, and `WebFluxConfigurer`. Regular `@Component` beans are -not scanned when the `@WebFluxTest` annotation is used. +`@JsonComponent`, `Converter`, `GenericConverter`, and `WebFluxConfigurer`. Regular +`@Component` beans are not scanned when the `@WebFluxTest` annotation is used. TIP: If you need to register extra components such as Jackson `Module`, you can import additional configuration classes using `@Import` on your test. diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTest.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTest.java index a3bf462c43..26ca5b8b0c 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTest.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/reactive/WebFluxTest.java @@ -43,9 +43,9 @@ import org.springframework.test.web.reactive.server.WebTestClient; *
* Using this annotation will disable full auto-configuration and instead apply only * configuration relevant to WebFlux tests (i.e. {@code @Controller}, - * {@code @ControllerAdvice}, {@code @JsonComponent}, {@code Converter}/{@code GenericConverter}, and - * {@code WebFluxConfigurer} beans but not {@code @Component}, {@code @Service} or - * {@code @Repository} beans). + * {@code @ControllerAdvice}, {@code @JsonComponent}, + * {@code Converter}/{@code GenericConverter}, and {@code WebFluxConfigurer} beans but not + * {@code @Component}, {@code @Service} or {@code @Repository} beans). *
* By default, tests annotated with {@code @WebFluxTest} will also auto-configure a * {@link WebTestClient}. For more fine-grained control of WebTestClient the diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.java index 171d13f54c..0cab34c7df 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.java @@ -43,9 +43,10 @@ import org.springframework.test.web.servlet.MockMvc; *
* Using this annotation will disable full auto-configuration and instead apply only * configuration relevant to MVC tests (i.e. {@code @Controller}, - * {@code @ControllerAdvice}, {@code @JsonComponent}, {@code Converter}/{@code GenericConverter}, {@code Filter}, - * {@code WebMvcConfigurer} and {@code HandlerMethodArgumentResolver} beans but not - * {@code @Component}, {@code @Service} or {@code @Repository} beans). + * {@code @ControllerAdvice}, {@code @JsonComponent}, + * {@code Converter}/{@code GenericConverter}, {@code Filter}, {@code WebMvcConfigurer} + * and {@code HandlerMethodArgumentResolver} beans but not {@code @Component}, + * {@code @Service} or {@code @Repository} beans). *
* By default, tests annotated with {@code @WebMvcTest} will also auto-configure Spring * Security and {@link MockMvc} (include support for HtmlUnit WebClient and Selenium