Skip to content

Releases: wiremock/wiremock-spring-boot

3.0.0

09 Oct 18:05
Compare
Choose a tag to compare

This is the first release within WireMock organization. There are many changes, hopefully these are all of them.

Breaking changes

  • changing groupId from com.maciejwalkowiak.spring to org.wiremock.integrations
  • @ConfigureWireMock no longer has property or properties, replaced by baseUrlProperties
  • @ConfigureWireMock no longer has stubLocation, replaced by filesUnderClasspath

Features

  • simplify usage, you just need to annotate test with @EnableWireMock, it only needs @ConfigureWireMock when changing default behavior
  • default properties wiremock.server.baseUrl and wiremock.server.port
  • @ConfigureWireMock now has baseUrlProperties, a list of properties that should be populated with the url.
  • @ConfigureWireMock now has portProperties, a list of properties that should be populated with the port.
  • @ConfigureWireMock now has usePortFromPredefinedPropertyIfFound, it will set the port to value of any existing port property.
  • @ConfigureWireMock now has filesUnderClasspath and filesUnderDirectory, both are lists of locations where it looks for mappings.
  • @ConfigureWireMock now has default name wiremock
  • Each WireMock has its logging prefixed with its port number.
  • When only one WireMock, it will be configured as a client for that server (WireMock.configureFor(wireMockServer.port());)

2.2.0

09 Oct 17:17
Compare
Choose a tag to compare
  • Adapted build to WireMock's conventions
  • Changed Maven group to org.wiremock.integrations

v2.1.3

24 Sep 10:35
dedbf85
Compare
Choose a tag to compare

What's Changed

  • Add support for multiple property injection by @rfelgent in #29

Full Changelog: v2.1.2...v2.1.3

v2.1.2

14 Feb 05:49
Compare
Choose a tag to compare

What's Changed

Full Changelog: v2.1.1...v2.1.2

v2.1.1

14 Feb 05:41
Compare
Choose a tag to compare

What's Changed

  • Avoid potential ClassCastException when handling context closed event. by @maciejwalkowiak in #24

Full Changelog: v2.1.0...v2.1.1

v2.1.0

10 Jan 12:34
Compare
Choose a tag to compare

What's Changed

  • Favor @Value to retrieve property value in README example by @scordio in #17
  • Add option to customize configuration on @ConfigureWireMock annotation by @maciejwalkowiak in #18
  • Upgrade to Spring Boot 3.2.1 and Wiremock Standalone. by @maciejwalkowiak in #23

New Contributors

Full Changelog: v2.0.0...v2.1.0

v2.0.0

22 Oct 21:04
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.2...v2.0.0

v1.0.2

22 Oct 20:40
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.1...v1.0.2

1.0.1

31 Mar 07:34
Compare
Choose a tag to compare

What's Changed

  • Introduce InjectWireMock annotation to avoid WireMock naming collision by @maciejwalkowiak in #9

Full Changelog: v1.0.0...v1.0.1

1.0.0

19 Mar 09:57
Compare
Choose a tag to compare

No changes since 0.1.0. v1.0.0 is the same code base but released to Maven Central.


WireMock Spring Boot library drastically simplifies WireMock configuration in a Spring Boot and JUnit 5 application.

🤩 Highlights

  • fully declarative WireMock setup
  • support for multiple WireMockServer instances - one per HTTP client as recommended in the WireMock documentation
  • automatically sets Spring environment properties
  • does not pollute Spring application context with extra beans
  • configuring WireMock extensions via @ConfigureWireMock(extensions = ... )
  • configuring stub locations via @ConfigureWireMock(stubLocations = ... )

✨ How to use

Use @EnableWireMock with @ConfigureWireMock with tests annotated that use SpringExtension, like @SpringBootTest:

@SpringBootTest
@EnableWireMock({
        @ConfigureWireMock(name = "user-service", property = "user-client.url")
})
class TodoControllerTests {

    @WireMock("user-service")
    private WireMockServer wiremock;
    
    @Autowired
    private Environment env;

    @Test
    void aTest() {
        env.getProperty("user-client.url"); // returns a URL to WireMockServer instance
        wiremock.stubFor(...);
    }
}
  • @EnableWireMock adds test context customizer and enables WireMockSpringExtension
  • @ConfigureWireMock creates a WireMockServer and passes the WireMockServer#baseUrl to a Spring environment property with a name given by property.
  • @WireMock injects WireMockServer instance to a test

📢 Feedback is much appreciated!

If you find this library useful, consider ❤️ Sponsoring the project! Thank you!