Annotation Interface ConfigureWireMock


@Retention(RUNTIME) public @interface ConfigureWireMock
Configures WireMock instance.
  • Element Details

    • port

      int port
      Port on which WireMock server is going to listen.

      -1 means disabled.

      0 means WireMock will pick random available port.

      >0 means that static port will be used.

      Returns:
      WireMock server port
      Default:
      0
    • httpsPort

      int httpsPort
      Same as port() but for HTTPS.
      Returns:
      HTTPS port to use.
      Default:
      -1
    • name

      String name
      The name of WireMock server.
      Returns:
      the name of WireMock server.
      Default:
      "wiremock"
    • usePortFromPredefinedPropertyIfFound

      boolean usePortFromPredefinedPropertyIfFound
      If the port property is found in Spring ApplicationContext it will be used. Enables a user to predefine a static port with a property.
      Returns:
      true if enabled, else false.
      Default:
      false
    • portProperties

      String[] portProperties
      Names of Spring properties to inject the WireMockServer.port()
      Returns:
      names of Spring properties to inject the WireMockServer.port()
      Default:
      {"wiremock.server.port"}
    • httpsPortProperties

      String[] httpsPortProperties
      Names of Spring properties to inject the WireMockServer.httpsPort()
      Returns:
      names of Spring properties to inject the WireMockServer.httpsPort()
      Default:
      {"wiremock.server.httpsPort"}
    • baseUrlProperties

      String[] baseUrlProperties
      Names of Spring properties to inject the WireMockServer.baseUrl().
      Returns:
      names of Spring properties to inject the WireMockServer.baseUrl().
      Default:
      {"wiremock.server.baseUrl"}
    • httpsBaseUrlProperties

      String[] httpsBaseUrlProperties
      Names of Spring properties to inject the WireMockServer.baseUrl().
      Returns:
      names of Spring properties to inject the WireMockServer.baseUrl().
      Default:
      {"wiremock.server.httpsBaseUrl"}
    • filesUnderClasspath

      String[] filesUnderClasspath
      Classpaths to pass to WireMockConfiguration.usingFilesUnderClasspath(String). First one that is found will be used. If a name() is supplied, it will first look for filesUnderClasspath()/name() enabling different mappings for differently named WireMocks.
      Default:
      {}
    • filesUnderDirectory

      String[] filesUnderDirectory
      Directory paths to pass to WireMockConfiguration.usingFilesUnderDirectory(String). First one that is found will be used. If a name() is supplied, it will first look for filesUnderClasspath()/name() enabling different mappings for differently named WireMocks.
      Default:
      {"wiremock", "stubs", "mappings"}
    • extensions

      Class<? extends com.github.tomakehurst.wiremock.extension.Extension>[] extensions
      WireMock extensions to register in WireMockServer.
      Returns:
      the extensions
      Default:
      {}
    • extensionFactories

      Class<? extends com.github.tomakehurst.wiremock.extension.ExtensionFactory>[] extensionFactories
      WireMock extensions to register in WireMockServer.
      Returns:
      the extensions
      Default:
      {}
    • configurationCustomizers

      Class<? extends WireMockConfigurationCustomizer>[] configurationCustomizers
      Customizes WireMockConfiguration used by WireMockServer instance. 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 resetWireMockServer
      When 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 WireMockServer should be invoked with WireMockServer.resetAll() between test runs.
      Default:
      true
    • registerSpringBean

      boolean registerSpringBean
      If true, it will register WireMockServer as a Spring Bean so that it can be Autowired by name.
      Default:
      false
    • globalTemplating

      boolean globalTemplating
      See Also:
      • WireMockConfiguration.globalTemplating(boolean)
      Default:
      false