Appendices

Appendix A: Common application properties

Various properties can be specified inside your application.properties file, inside your application.yml file, or as command line switches. This appendix provides a list of common Spring Cloud Contract properties and references to the underlying classes that consume them.spring-doc.cn

Property contributions can come from additional jar files on your classpath, so you should not consider this an exhaustive list. Also, you can define your own properties.

A.1. Default application properties

Name Default Description

stubrunner.amqp.enabledspring-doc.cn

falsespring-doc.cn

Whether to enable support for Stub Runner and AMQP.spring-doc.cn

stubrunner.amqp.mockCOnnectionspring-doc.cn

truespring-doc.cn

Whether to enable support for Stub Runner and AMQP mocked connection factory.spring-doc.cn

stubrunner.classifierspring-doc.cn

stubsspring-doc.cn

The classifier to use by default in ivy co-ordinates for a stub.spring-doc.cn

stubrunner.cloud.consul.enabledspring-doc.cn

truespring-doc.cn

Whether to enable stubs registration in Consul.spring-doc.cn

stubrunner.cloud.delegate.enabledspring-doc.cn

truespring-doc.cn

Whether to enable DiscoveryClient’s Stub Runner implementation.spring-doc.cn

stubrunner.cloud.enabledspring-doc.cn

truespring-doc.cn

Whether to enable Spring Cloud support for Stub Runner.spring-doc.cn

stubrunner.cloud.eureka.enabledspring-doc.cn

truespring-doc.cn

Whether to enable stubs registration in Eureka.spring-doc.cn

stubrunner.cloud.loadbalancer.enabledspring-doc.cn

truespring-doc.cn

Whether to enable Stub Runner’s Spring Cloud Load Balancer integration.spring-doc.cn

stubrunner.cloud.stubbed.discovery.enabledspring-doc.cn

truespring-doc.cn

Whether Service Discovery should be stubbed for Stub Runner. If set to false, stubs will get registered in real service discovery.spring-doc.cn

stubrunner.cloud.zookeeper.enabledspring-doc.cn

truespring-doc.cn

Whether to enable stubs registration in Zookeeper.spring-doc.cn

stubrunner.consumer-namespring-doc.cn

You can override the default {@code spring.application.name} of this field by setting a value to this parameter.spring-doc.cn

stubrunner.delete-stubs-after-testspring-doc.cn

truespring-doc.cn

If set to {@code false} will NOT delete stubs from a temporary folder after running tests.spring-doc.cn

stubrunner.fail-on-no-stubsspring-doc.cn

truespring-doc.cn

When enabled, this flag will tell stub runner to throw an exception when no stubs / contracts were found.spring-doc.cn

stubrunner.generate-stubsspring-doc.cn

falsespring-doc.cn

When enabled, this flag will tell stub runner to not load the generated stubs, but convert the found contracts at runtime to a stub format and run those stubs.spring-doc.cn

stubrunner.http-server-stub-configurerspring-doc.cn

Configuration for an HTTP server stub.spring-doc.cn

stubrunner.idsspring-doc.cn

[]spring-doc.cn

The ids of the stubs to run in "ivy" notation ([groupId]:artifactId:[version]:[classifier][:port]). {@code groupId}, {@code classifier}, {@code version} and {@code port} can be optional.spring-doc.cn

stubrunner.ids-to-service-idsspring-doc.cn

Mapping of Ivy notation based ids to serviceIds inside your application. Example "a:b" → "myService" "artifactId" → "myOtherService"spring-doc.cn

stubrunner.integration.enabledspring-doc.cn

truespring-doc.cn

Whether to enable Stub Runner integration with Spring Integration.spring-doc.cn

stubrunner.jms.enabledspring-doc.cn

truespring-doc.cn

Whether to enable Stub Runner integration with Spring JMS.spring-doc.cn

stubrunner.kafka.enabledspring-doc.cn

truespring-doc.cn

Whether to enable Stub Runner integration with Spring Kafka.spring-doc.cn

stubrunner.kafka.initializer.enabledspring-doc.cn

truespring-doc.cn

Whether to allow Stub Runner to take care of polling for messages instead of the KafkaStubMessages component. The latter should be used only on the producer side.spring-doc.cn

stubrunner.mappings-output-folderspring-doc.cn

Dumps the mappings of each HTTP server to the selected folder.spring-doc.cn

stubrunner.max-portspring-doc.cn

15000spring-doc.cn

Max value of a port for the automatically started WireMock server.spring-doc.cn

stubrunner.min-portspring-doc.cn

10000spring-doc.cn

Min value of a port for the automatically started WireMock server.spring-doc.cn

stubrunner.passwordspring-doc.cn

Repository password.spring-doc.cn

stubrunner.propertiesspring-doc.cn

Map of properties that can be passed to custom {@link org.springframework.cloud.contract.stubrunner.StubDownloaderBuilder}.spring-doc.cn

stubrunner.proxy-hostspring-doc.cn

Repository proxy host.spring-doc.cn

stubrunner.proxy-portspring-doc.cn

Repository proxy port.spring-doc.cn

stubrunner.server-idspring-doc.cn

stubrunner.stream.enabledspring-doc.cn

truespring-doc.cn

Whether to enable Stub Runner integration with Spring Cloud Stream.spring-doc.cn

stubrunner.stubs-modespring-doc.cn

Pick where the stubs should come from.spring-doc.cn

stubrunner.stubs-per-consumerspring-doc.cn

falsespring-doc.cn

Should only stubs for this particular consumer get registered in HTTP server stub.spring-doc.cn

stubrunner.usernamespring-doc.cn

Repository username.spring-doc.cn

wiremock.placeholders.enabledspring-doc.cn

truespring-doc.cn

Flag to indicate that http URLs in generated wiremock stubs should be filtered to add or resolve a placeholder for a dynamic port.spring-doc.cn

wiremock.reset-mappings-after-each-testspring-doc.cn

falsespring-doc.cn

wiremock.rest-template-ssl-enabledspring-doc.cn

falsespring-doc.cn

wiremock.server.filesspring-doc.cn

[]spring-doc.cn

wiremock.server.https-portspring-doc.cn

-1spring-doc.cn

wiremock.server.https-port-dynamicspring-doc.cn

falsespring-doc.cn

wiremock.server.portspring-doc.cn

8080spring-doc.cn

wiremock.server.port-dynamicspring-doc.cn

falsespring-doc.cn

wiremock.server.stubsspring-doc.cn

[]spring-doc.cn

A.2. Additional application properties

The following properties can be passed as a system property (for example, stubrunner.properties.git.branch), as an environment variable (for example, STUBRUNNER_PROPERTIES_GIT_BRANCH), or as a property inside stub runner’s annotation or a JUnit Rule (JUnit 4) or Extension (JUnit 5). In the latter case, you can pass the git.branch property instead of stubrunner.properties.git.branch.
Table 1. Stubrunner Properties Options
Name Default Description

stubrunner.properties.pactbroker.provider-name-with-group-idspring-doc.cn

falsespring-doc.cn

When using the Pact Broker-based approach, you can automatically group ID to the provider name.spring-doc.cn

stubrunner.properties.git.branchspring-doc.cn

When using the SCM-based approach, you can customize the branch name to check out.spring-doc.cn

stubrunner.properties.git.commit-messagespring-doc.cn

Updating project [$project] with stubsspring-doc.cn

When using the SCM based approach, you can customize the commit message for created stubs. The $project text is replaced with the project name.spring-doc.cn

stubrunner.properties.git.no-of-attemptsspring-doc.cn

10spring-doc.cn

When using the-SCM based approach, you can customize the number of retries to push the stubs to Git.spring-doc.cn

stubrunner.properties.git.usernamespring-doc.cn

When using the SCM-based approach, you can pass the username to connect to the git repository.spring-doc.cn

stubrunner.properties.git.passwordspring-doc.cn

When using the SCM-based approach, you can pass the password to connect to the git repository.spring-doc.cn

stubrunner.properties.git.wait-between-attemptsspring-doc.cn

1000spring-doc.cn

When using the SCM-based approach, you can customize waiting time in ms between attempts to push the stubs to git.spring-doc.cn

stubrunner.properties.git.ensure-git-suffixspring-doc.cn

truespring-doc.cn

When using the SCM based approach, you can prevent stubrunner from adding .git to the repository URL by setting this property to false. This adds compatibility with git repositories which do not support such URLs, for example Azure DevOps.spring-doc.cn

stubrunner.properties.stubs.find-producerspring-doc.cn

falsespring-doc.cn

When using the stubs protocol, you can toggle this flag to search for contracts in the group id / artifact id instead of taking the stubs directly from the provided folder.spring-doc.cn