注释类型 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
.- 从以下版本开始:
- 1.4.0
- 另请参阅:
MockMvcAutoConfiguration
,SpringBootMockMvcBuilderCustomizer
可选元素概要
可选元素 修饰符和类型 可选元素 说明 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
If Spring Security'sMockMvc
support should be auto-configured when it is on the classpath.boolean
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.
元素详细资料
addFilters
boolean addFilters
If filters from the application context should be registered with MockMVC. Defaults totrue
.- 返回:
- if filters should be added
- 默认值:
- true
print
@PropertyMapping(skip=ON_DEFAULT_VALUE) MockMvcPrint print
HowMvcResult
information should be printed after each MockMVC invocation.- 返回:
- how information is printed
- 默认值:
- org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrint.DEFAULT
printOnlyOnFailure
boolean printOnlyOnFailure
IfMvcResult
information should be printed only if the test fails.- 返回:
true
if printing only occurs on failure
- 默认值:
- true
webClientEnabled
@PropertyMapping("webclient.enabled") boolean webClientEnabled
If aWebClient
should be auto-configured when HtmlUnit is on the classpath. Defaults totrue
.- 返回:
- if a
WebClient
is auto-configured
- 默认值:
- true
webDriverEnabled
@PropertyMapping("webdriver.enabled") boolean webDriverEnabled
If aWebDriver
should be auto-configured when Selenium is on the classpath. Defaults totrue
.- 返回:
- if a
WebDriver
is auto-configured
- 默认值:
- true
secure
boolean secure
If Spring Security'sMockMvc
support should be auto-configured when it is on the classpath. Defaults totrue
.- 返回:
- if Spring Security's MockMvc support is auto-configured
- 默认值:
- true