Annotation Type AutoConfigureMockMvc
@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented @Inherited @ImportAutoConfiguration @PropertyMapping("spring.test.mockmvc") public @interface AutoConfigureMockMvc
Annotation that can be applied to a test class to enable and configure auto-configuration ofMockMvc
.- Since:
- 1.4.0
- See Also:
MockMvcAutoConfiguration
,SpringBootMockMvcBuilderCustomizer
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
addFilters
If filters from the application context should be registered with MockMVC.MockMvcPrint
print
HowMvcResult
information should be printed after each MockMVC invocation.boolean
printOnlyOnFailure
IfMvcResult
information should be printed only if the test fails.boolean
secure
Deprecated.since 2.1.0 in favor of Spring Security's testing supportboolean
webClientEnabled
If aWebClient
should be auto-configured when HtmlUnit is on the classpath.boolean
webDriverEnabled
If aWebDriver
should be auto-configured when Selenium is on the classpath.
Element Detail
addFilters
boolean addFilters
If filters from the application context should be registered with MockMVC. Defaults totrue
.- Returns:
- if filters should be added
- Default:
- true
print
@PropertyMapping(skip=ON_DEFAULT_VALUE) MockMvcPrint print
HowMvcResult
information should be printed after each MockMVC invocation.- Returns:
- how information is printed
- Default:
- org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrint.DEFAULT
printOnlyOnFailure
boolean printOnlyOnFailure
IfMvcResult
information should be printed only if the test fails.- Returns:
true
if printing only occurs on failure
- Default:
- true
webClientEnabled
@PropertyMapping("webclient.enabled") boolean webClientEnabled
If aWebClient
should be auto-configured when HtmlUnit is on the classpath. Defaults totrue
.- Returns:
- if a
WebClient
is auto-configured
- Default:
- true
webDriverEnabled
@PropertyMapping("webdriver.enabled") boolean webDriverEnabled
If aWebDriver
should be auto-configured when Selenium is on the classpath. Defaults totrue
.- Returns:
- if a
WebDriver
is auto-configured
- Default:
- true
secure
@Deprecated boolean secure
Deprecated.since 2.1.0 in favor of Spring Security's testing supportIf Spring Security'sMockMvc
support should be auto-configured when it is on the classpath. Defaults totrue
.- Returns:
- if Spring Security's MockMvc support is auto-configured
- Default:
- true