Standalone stub server using Spring Cloud Contract WireMock

Eric Anicet
7 min readAug 28, 2023

Creating a standalone stub server is important in order not to depend on an API that isn’t yet available, isn’t complete, or is expensive to access during the development phase. The front-end team can easily advance its functionality by simulating all the requests and responses that will be produced by the APIs later.

In this story, we’ll explain how to build a standalone stub server for stubbing REST APIs using Spring Cloud Contract WireMock.

· Prerequisites
· Overview
What is WireMock?
Spring Cloud Contract WireMock
· Spring Boot Stub Server App Setup
Project Setup
Create Mock JSON Files
Containerize application
· Testing
· Conclusion
· References

Prerequisites

This is the list of all the prerequisites for following this story:

  • Java 17
  • Starter Boot 3.0.6
  • Maven 3.6.3
  • Optionally, Docker installed
  • Optionally, Docker compose installed

--

--