Annotation Type 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 or WebTestClient-based testing of a reactive web application.

Allows configuration of the output directory and the host, scheme, and port of generated URIs. When further configuration is required a RestDocsMockMvcConfigurationCustomizer or RestDocsWebTestClientConfigurationCustomizer bean can be used.

Since:
1.4.0
Author:
Andy Wilkinson
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    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 (typically http or https) to be used in documented URIs.
    The output directory to which generated snippets will be written.
  • Element Details

    • value

      @AliasFor("outputDir") String value
      The output directory to which generated snippets will be written. An alias for outputDir().
      Returns:
      the output directory
      Default:
      ""
    • outputDir

      @AliasFor("value") String outputDir
      The output directory to which generated snippets will be written. An alias for value().
      Returns:
      the output directory
      Default:
      ""
    • uriScheme

      String uriScheme
      The scheme (typically http or https) to be used in documented URIs. Defaults to http.
      Returns:
      the scheme
      Default:
      "http"
    • uriHost

      String uriHost
      The host to be used in documented URIs. Defaults to localhost.
      Returns:
      the host
      Default:
      "localhost"
    • uriPort

      int uriPort
      The port to be used in documented URIs. Defaults to 8080.
      Returns:
      the port
      Default:
      8080