Annotation that can be used in combination with
for a typical Spring MVC test. Can be used when a test focuses only
Spring MVC components.
Using this annotation will disable full auto-configuration and instead apply only
configuration relevant to MVC tests (i.e.
HandlerMethodArgumentResolver beans but not
By default, tests annotated with
@WebMvcTest will also auto-configure Spring
MockMvc (include support for HtmlUnit WebClient and Selenium
WebDriver). For more fine-grained control of MockMVC the
@AutoConfigureMockMvc annotation can be used.
@WebMvcTest is used in combination with
@Import to create any collaborators required by your
If you are looking to load your full application configuration and use MockMVC, you
@SpringBootTest combined with
@AutoConfigureMockMvc rather than this annotation.