Annotation Type AutoConfigureStubRunner
-
@Target(TYPE) @Retention(RUNTIME) @Documented @ImportAutoConfiguration @AutoConfigureMessageVerifier @PropertyMapping(value="stubrunner", skip=ON_DEFAULT_VALUE) public @interface AutoConfigureStubRunner
- Author:
- Dave Syer
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description StringclassifierStringconsumerNameYou can override the defaultspring.application.nameof this field by setting a value to this parameter.booleandeleteStubsAfterTestbooleanfailOnNoStubsbooleangenerateStubsClass<? extends HttpServerStubConfigurer>httpServerStubConfigurerConfiguration for an HTTP server stub.String[]idsStringmappingsOutputFolderFor debugging purposes you can output the registered mappings to a given folder.intmaxPortintminPortString[]propertiesProperties in form key=value.StringrepositoryRootStubRunnerProperties.StubsModestubsModeThe way stubs should be found and registered.booleanstubsPerConsumerOn the producer side the consumers can have a folder that contains contracts related only to them.
-
-
-
-
repositoryRoot
String repositoryRoot
- Returns:
- The repository root to use (where the stubs should be downloaded from).
- Default:
- ""
-
-
-
ids
String[] ids
- Returns:
- The ids of the stubs to run in "ivy" notation
([groupId]:artifactId[:version][:classifier][:port]).
groupId,version,classifierandportcan be optional.
- Default:
- {}
-
-
-
classifier
String classifier
- Returns:
- The classifier to use by default in ivy co-ordinates for a stub.
- Default:
- "stubs"
-
-
-
stubsPerConsumer
boolean stubsPerConsumer
On the producer side the consumers can have a folder that contains contracts related only to them. By setting the flag totruewe no longer register all stubs but only those that correspond to the consumer application's name. In other words we'll scan the path of every stub and if it contains the name of the consumer in the path only then will it get registered. Let's look at this example. Let's assume that we have a producer calledfooand two consumersbazandbar. On thefooproducer side the contracts would look like thissrc/test/resources/contracts/baz-service/some/contracts/...andsrc/test/resources/contracts/bar-service/some/contracts/.... Then when the consumer withspring.application.nameor theconsumerName()annotation parameter set tobaz-servicewill define the test setup as follows@AutoConfigureStubRunner(ids = "com.example:foo:+:stubs:8095", stubsPerConsumer=true)then only the stubs registered undersrc/test/resources/contracts/baz-service/some/contracts/...will get registered and those undersrc/test/resources/contracts/bar-service/some/contracts/...will get ignored.- Returns:
trueto turn on the feature- See Also:
- issue 224
- Default:
- false
-
-
-
mappingsOutputFolder
String mappingsOutputFolder
For debugging purposes you can output the registered mappings to a given folder. Each HTTP server stub will have its own subfolder where all the mappings will get stored.- Returns:
- where the mappings output should be stored
- See Also:
- issue 355
- Default:
- ""
-
-
-
stubsMode
StubRunnerProperties.StubsMode stubsMode
The way stubs should be found and registered. Defaults toStubRunnerProperties.StubsMode.CLASSPATH.- Returns:
- the type of stubs mode
- Default:
- org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties.StubsMode.CLASSPATH
-
-
-
properties
String[] properties
Properties in form key=value.- Returns:
- the properties to add
- Default:
- {}
-
-
-
httpServerStubConfigurer
Class<? extends HttpServerStubConfigurer> httpServerStubConfigurer
Configuration for an HTTP server stub.- Returns:
- class that allows to perform additional HTTP server stub configuration
- Default:
- org.springframework.cloud.contract.stubrunner.HttpServerStubConfigurer.NoOpHttpServerStubConfigurer.class
-
-