批注接口 AutoConfigureRestDocs
@Target(TYPE)
@Retention(RUNTIME)
@Documented
@Inherited
@ImportAutoConfiguration
@Import(org.springframework.boot.test.autoconfigure.restdocs.RestDocumentationContextProviderRegistrar.class)
@PropertyMapping("spring.test.restdocs")
public @interface AutoConfigureRestDocs
Annotation that can be applied to a test class to enable and configure
auto-configuration of Spring REST Docs. The auto-configuration sets up
MockMvc
-based testing of a servlet web application, WebTestClient
-based
testing of a reactive web application, or RestAssured
-based testing of any web
application over HTTP.
Allows configuration of the output directory and the host, scheme, and port of
generated URIs. When further configuration is required a
RestDocsMockMvcConfigurationCustomizer
,
RestDocsWebTestClientConfigurationCustomizer
, or
RestDocsRestAssuredConfigurationCustomizer
bean can be used.
- 从以下版本开始:
- 1.4.0
- 作者:
- Andy Wilkinson
- 另请参阅:
-
可选元素概要
可选元素修饰符和类型可选元素说明The output directory to which generated snippets will be written.The host to be used in documented URIs.int
The port to be used in documented URIs.The scheme (typicallyhttp
orhttps
) to be used in documented URIs.The output directory to which generated snippets will be written.
-
元素详细资料
-
value
The output directory to which generated snippets will be written. An alias foroutputDir()
.- 返回:
- the output directory
- 默认值:
""
-
outputDir
The output directory to which generated snippets will be written. An alias forvalue()
.- 返回:
- the output directory
- 默认值:
""
-
uriScheme
String uriSchemeThe scheme (typicallyhttp
orhttps
) to be used in documented URIs. Defaults tohttp
.- 返回:
- the scheme
- 默认值:
"http"
-
uriHost
String uriHostThe host to be used in documented URIs. Defaults tolocalhost
.- 返回:
- the host
- 默认值:
"localhost"
-
uriPort
int uriPortThe port to be used in documented URIs. Defaults to8080
.- 返回:
- the port
- 默认值:
8080
-