Annotation Type AutoConfigureWireMock


@Target(TYPE) @Retention(RUNTIME) @Documented @Import(WireMockConfiguration.class) @PropertyMapping(value="wiremock.server", skip=ON_DEFAULT_VALUE) @AutoConfigureHttpClient @Inherited public @interface AutoConfigureWireMock
Annotation for test classes that want to start a WireMock server as part of the Spring Application Context. The port, https port and stub locations (if any) can all be controlled directly here. For more fine-grained control of the server instance add a bean of type Options to the application context.
Author:
Dave Syer
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The resource locations to use for loading WireMock response bodies.
    int
    If specified, configures WireMock instance to enable HTTPS on specified port.
    int
    Configures WireMock instance to listen on specified port.
    The resource locations to use for loading WireMock mappings.
  • Element Details

    • port

      int port
      Configures WireMock instance to listen on specified port.

      Set this value to 0 for WireMock to listen to a random port.

      Returns:
      port to which WireMock instance should listen to
      Default:
      8080
    • httpsPort

      int httpsPort
      If specified, configures WireMock instance to enable HTTPS on specified port.

      Set this value to 0 for WireMock to listen to a random port.

      Returns:
      port to which WireMock instance should listen to
      Default:
      -1
    • stubs

      String[] stubs
      The resource locations to use for loading WireMock mappings.

      When none specified, src/test/resources/mappings is used as default location.

      To customize the location, this attribute must be set to the directory where mappings are stored.

      Returns:
      locations to read WireMock mappings from
      Default:
      {""}
    • files

      String[] files
      The resource locations to use for loading WireMock response bodies.

      When none specified, src/test/resources/__files is used as default.

      To customize the location, this attribute must be set to the parent directory of __files directory.

      Returns:
      locations to read WireMock response bodies from
      Default:
      {""}