This documentation takes you through the Spring Cloud Contract Workshops by asking you to complete a series of tasks that teach you both basic and more advanced concepts behind Consumer Driven Contracts in general and Spring Cloud Contract in particular.
Setup
The repository mostly consists of pairs of producer
and consumer
applications that
show different use cases of Spring Cloud Contract. The initial state of the repository
is such that all the examples are working and the tests are passing. In order for you to
prepare the repository so that it has only the basic pieces of code ready for use,
run the following Gradle command:
$ git clone https://github.com/spring-cloud-samples/spring-cloud-contract-samples
$ cd spring-cloud-contract-samples
$ ./gradlew prepareForWorkshops
The preceding commands removes most of the code, contracts, and project setup details, so that you can start the workshops.
Tip
|
Whenever you're lost, do not worry. At any time, you can check what the contents in
the master branch where all of the examples are ready and working.
|
Important
|
You must have Maven installed. Check out the website on how to download and install Maven. |
Generating the documentation
To generate the documentation, call the Gradle task, as shown below:
$ git clone https://github.com/spring-cloud-samples/spring-cloud-contract-samples
$ cd spring-cloud-contract-samples
$ ./gradlew generateDocumentation
Resources
The following resources may help you learn about Spring Cloud Contracts:
Adib Saikali’s Introduction to Consumer Driven Contracts
Introduction to Spring Cloud Contract
Tasks
-
Contracts on the Producer Side
-
Simple DSL examples for HTTP & Messaging
-
Base classes picked by convention
-
Generating documentation from contracts
-
-
Contracts in an External Repository
-
Simple DSL examples for HTTP & Messaging
-
Base classes picked by mappings
-
Generating documentation from contracts
-
-
Spring Cloud Contract with Rest Docs
-
Generating stubs using Rest Docs
-
Generating contracts using Rest Docs
-
Reading stubs from classpath via Spring Cloud Contract WireMock
-
Reading stubs from classpath via Stub Runner
-
-
Extras
-
Spring Cloud Contract advanced
-
Using regular expressions
-
Code execution
-
Referencing request from response
-
Working with stub and test matchers
-
Working with random ports
-
Asynchronous communication
-
Priority
-
-
Creating a library with common code shareable between teams
-
Requires completion of "Contracts on the producer side"
-
-
-
Requires completion of stubs per consumer"
-
-
Using stubs with Stub Runner Boot
-
Requires completion of "Spring Cloud Contract advanced"
-