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 ElementsModifier and TypeOptional ElementDescriptionString[]The resource locations to use for loading WireMock response bodies.intIf specified, configures WireMock instance to enable HTTPS on specified port.intConfigures WireMock instance to listen on specified port.String[]The resource locations to use for loading WireMock mappings.
-
Element Details
-
port
int portConfigures 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 httpsPortIf 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[] stubsThe 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[] filesThe 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:
- {""}
-