r/SpringBoot • • Dec 06 '24

Spring Boot + WireMock integration

Hey r/SpringBoot! The official WireMock + Spring Boot integration is now available: https://wiremock.org/docs/spring-boot/

Mocking APIs with WireMock in Spring Boot integration tests is a very common approach for achieving isolated, deterministic tests, but integrating the two can be painful due to the challenges around managing random port numbers.

The WireMock Spring Boot integration solves this problem by supporting annotation-driven configuration of one or more WireMock instances, plus injection of URLs and port numbers as Spring properties.

We’ve written a bit more about this here: https://www.wiremock.io/post/wiremock-now-has-an-official-spring-boot-integration

51 Upvotes

8 comments sorted by

2

u/Sheldor5 Dec 06 '24

what is the difference/advantage to https://www.mock-server.com/ ?

4

u/tomakehurst Dec 06 '24

WireMock has a few key advantages over MockServer:
* It's in active development and backed by a well-funded company, whereas MockServer is in maintenance mode these days.
* Although MockServer's matchers are very good, WireMock can do a few things it can't including multipart request matching, relative/absolute date matching and AND/OR/NOT combinators.
* WireMock has a very large response template function library.
* WireMock has many extension points, and has a number of high-quality extension libraries (both 1st and 3rd party), including ones that add gRPC, GraphQL and dynamic state support.

1

u/Majestic_Scratch522 Dec 06 '24

What's that is it like mockito ?

2

u/tomakehurst Dec 06 '24

It works at the HTTP layer over a network connection rather than substituting objects in memory like Mockito does, but many of the concepts like stubbing and verification work in a similar way.

3

u/[deleted] Dec 06 '24 edited Apr 17 '26

Data brokers are selling your info right now. I used Redact to mass delete my posts which can also opt out of data broker sites. Instagram, Twitter/X, Discord and more.

familiar swim hospital nutty profit school busy file marble ink

2

u/Texume Dec 06 '24

Amazing work! about time for a new project

2

u/spaces_over_tabs Dec 07 '24

Amazing!! Thank you