Spring Cloud Contract 1.0.0.RELEASE is available

Releases | Marcin Grzejszczak | September 23, 2016 | ...

On behalf of the team, I am happy to announce the general availability of the Spring Cloud Contract in version 1.0.0.RELEASE. You can download it from Spring Release or Maven Central. The reference documentation is available here. The release notes are available here.

What is Spring Cloud Contract for? What you always need is confidence in pushing new features into a new application or service in a distributed system. Spring Cloud Contract project provides support for Consumer Driven Contracts and service schemas in Spring applications, covering a range of options for writing tests, publishing them as assets, asserting that a contract is kept by producers and consumers, for HTTP and message-based interactions.

Spring Cloud Contract consists of three main projects:

At a high level:

Spring Cloud Contract Verifier

It's a tool that enables Consumer Driven Contract (CDC) development of JVM-based applications. It is shipped with Contract Definition Language (DSL). Contract definitions are used to produce following resources:

  • JSON stub definitions to be used by WireMock when doing integration testing on the consumer side. (Test code must still be written by hand, test data is produced by Spring Cloud Contract Verifier).
  • Messaging routes if you’re using one. We’re integrating with Spring Integration, Spring Cloud Stream and Apache Camel. You can however set your own integrations if you want to
  • Acceptance tests (in JUnit or Spock) used to verify if server-side implementation of the API is compliant with the contract (producer tests). Tests are generated by Spring Cloud Contract Verifier.

Spring Cloud Contract Verifier moves TDD to the level of software architecture.

Spring Cloud Contract WireMock

Gives you the possibility to use WireMock with different servers by using the "ambient" server embedded in a Spring Boot application. Check out the samples for more details.

If you have a Spring Boot application that uses Tomcat as an embedded server, for example (the default with spring-boot-starter-web), then you can simply add spring-cloud-contract-wiremock to your classpath and add @AutoConfigureWireMock in order to be able to use Wiremock in your tests. Wiremock runs as a stub server and you can register stub behaviour using a Java API or via static JSON declarations as part of your test

Spring Cloud Contract RestDocs

Spring RestDocs can be used to generate documentation (e.g. in asciidoctor format) for an HTTP API with Spring MockMvc or RestEasy. At the same time as you generate documentation for your API, you can also generate WireMock stubs, by using Spring Cloud Contract WireMock. Just write your normal RestDocs test cases and use @AutoConfigureRestDocs to have stubs automatically in the restdocs output directory

As always, you can stay in touch with us either in GitHub, on Stack Overflow, on Gitter, or on Twitter.

Get the Spring newsletter

Thank you for your interest. Someone will get back to you shortly.

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Spring Runtime offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all