Include WebMvcRegistrations beans in WebMvcTest
See gh-27823
This commit is contained in:
committed by
Stephane Nicoll
parent
0fed29d440
commit
6e9bdacc10
@@ -368,7 +368,7 @@ include::{docs-java}/features/testing/springbootapplications/jsontests/MyJsonAss
|
||||
[[features.testing.spring-boot-applications.spring-mvc-tests]]
|
||||
==== Auto-configured Spring MVC Tests
|
||||
To test whether Spring MVC controllers are working as expected, use the `@WebMvcTest` annotation.
|
||||
`@WebMvcTest` auto-configures the Spring MVC infrastructure and limits scanned beans to `@Controller`, `@ControllerAdvice`, `@JsonComponent`, `Converter`, `GenericConverter`, `Filter`, `HandlerInterceptor`, `WebMvcConfigurer`, and `HandlerMethodArgumentResolver`.
|
||||
`@WebMvcTest` auto-configures the Spring MVC infrastructure and limits scanned beans to `@Controller`, `@ControllerAdvice`, `@JsonComponent`, `Converter`, `GenericConverter`, `Filter`, `HandlerInterceptor`, `WebMvcConfigurer`, `WebMvcRegistrations`, and `HandlerMethodArgumentResolver`.
|
||||
Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@WebMvcTest` annotation is used.
|
||||
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user