Package org.wiremock.spring
Annotation Interface ConfigureWireMock
Configures WireMock instance.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]Names of Spring properties to inject theWireMockServer.baseUrl().Class<? extends WireMockConfigurationCustomizer>[]CustomizesWireMockConfigurationused byWireMockServerinstance.Class<? extends com.github.tomakehurst.wiremock.extension.ExtensionFactory>[]WireMock extensions to register inWireMockServer.Class<? extends com.github.tomakehurst.wiremock.extension.Extension>[]WireMock extensions to register inWireMockServer.String[]Classpaths to pass toWireMockConfiguration.usingFilesUnderClasspath(String).String[]Directory paths to pass toWireMockConfiguration.usingFilesUnderDirectory(String).String[]Names of Spring properties to inject theWireMockServer.baseUrl().intSame asport()but for HTTPS.String[]Names of Spring properties to inject theWireMockServer.httpsPort()The name of WireMock server.intPort on which WireMock server is going to listen.String[]Names of Spring properties to inject theWireMockServer.port()booleanIftrue, it will registerWireMockServeras a Spring Bean so that it can beAutowiredby name.booleanWhen tests are running concurrently they will break each other if servers are being reset between tests.booleanIf the port property is found in SpringApplicationContextit will be used.
-
Element Details
-
port
int portPort on which WireMock server is going to listen.-1means disabled.0means WireMock will pick random available port.>0means that static port will be used.- Returns:
- WireMock server port
- Default:
- 0
-
httpsPort
int httpsPortSame asport()but for HTTPS.- Returns:
- HTTPS port to use.
- Default:
- -1
-
name
String nameThe name of WireMock server.- Returns:
- the name of WireMock server.
- Default:
- "wiremock"
-
usePortFromPredefinedPropertyIfFound
boolean usePortFromPredefinedPropertyIfFoundIf the port property is found in SpringApplicationContextit will be used. Enables a user to predefine a static port with a property.- Returns:
- true if enabled, else false.
- Default:
- false
-
portProperties
String[] portPropertiesNames of Spring properties to inject theWireMockServer.port()- Returns:
- names of Spring properties to inject the
WireMockServer.port()
- Default:
- {"wiremock.server.port"}
-
httpsPortProperties
String[] httpsPortPropertiesNames of Spring properties to inject theWireMockServer.httpsPort()- Returns:
- names of Spring properties to inject the
WireMockServer.httpsPort()
- Default:
- {"wiremock.server.httpsPort"}
-
baseUrlProperties
String[] baseUrlPropertiesNames of Spring properties to inject theWireMockServer.baseUrl().- Returns:
- names of Spring properties to inject the
WireMockServer.baseUrl().
- Default:
- {"wiremock.server.baseUrl"}
-
httpsBaseUrlProperties
String[] httpsBaseUrlPropertiesNames of Spring properties to inject theWireMockServer.baseUrl().- Returns:
- names of Spring properties to inject the
WireMockServer.baseUrl().
- Default:
- {"wiremock.server.httpsBaseUrl"}
-
filesUnderClasspath
String[] filesUnderClasspathClasspaths to pass toWireMockConfiguration.usingFilesUnderClasspath(String). First one that is found will be used. If aname()is supplied, it will first look forfilesUnderClasspath()/name()enabling different mappings for differently named WireMocks.- Default:
- {}
-
filesUnderDirectory
String[] filesUnderDirectoryDirectory paths to pass toWireMockConfiguration.usingFilesUnderDirectory(String). First one that is found will be used. If aname()is supplied, it will first look forfilesUnderClasspath()/name()enabling different mappings for differently named WireMocks.- Default:
- {"wiremock", "stubs", "mappings"}
-
extensions
Class<? extends com.github.tomakehurst.wiremock.extension.Extension>[] extensionsWireMock extensions to register inWireMockServer.- Returns:
- the extensions
- Default:
- {}
-
extensionFactories
Class<? extends com.github.tomakehurst.wiremock.extension.ExtensionFactory>[] extensionFactoriesWireMock extensions to register inWireMockServer.- Returns:
- the extensions
- Default:
- {}
-
configurationCustomizers
Class<? extends WireMockConfigurationCustomizer>[] configurationCustomizersCustomizesWireMockConfigurationused byWireMockServerinstance. Customizers are ordered by their natural order in this array. Each customizer must have no-arg constructor.- Returns:
- the configuration customizers classes
- Default:
- {}
-
resetWireMockServer
boolean resetWireMockServerWhen tests are running concurrently they will break each other if servers are being reset between tests. Automatic reset is turned on by default, this option allows a user to turn it off.- Returns:
- true if
WireMockServershould be invoked withWireMockServer.resetAll()between test runs.
- Default:
- true
-
registerSpringBean
boolean registerSpringBeanIftrue, it will registerWireMockServeras a Spring Bean so that it can beAutowiredby name.- Default:
- false
-