Getting Started

Install Prerequisites

Start your installations before the presentation begins so that the dependencies are able to download before we start the workshop.

Install docker :

  • Mac:

  • Window:

  • Linux:

Pull docker images:

$ docker pull springcloud/spring-cloud-contract:2.1.1.RELEASE
$ docker pull springcloud/spring-cloud-contract-stub-runner:2.1.1.RELEASE

Install Node:

Clone Repos:

$ git clone
$ git clone

Client-Side Developers

From the root of contract-driven-development run the following:

$ npm install

Server-Side Developers

From the root of contract-driven-development run the following:

$ cd produce-service
$ ./mvnw package

Currently the contract of addProduce.yml is always sending the same response, ignoring the contents of the request the client is sending. Spring Cloud Contract can allow contracts to be more dynamic, for example allow fields within the response to pull from the request. Let's update addProduce.yml to do this.

Update POST contract to respond with request body

Every service is going to be composed of many different contracts. Defining how an API should respond to a given request. It's important that we not only define what happens for successful responses, but unsuccessful ones as well. Currently we have a contract findProduceByName.yml that defines what happens when a client successful searches for a subset of produce. Let's write a contract for when a client sends an invalid search request that has special characters in it.