Proposal: Add static loadMappingsFrom(...) methods in WireMock.java for default instance usage

Open Beginner friendly
#3,102 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
java
Domain
api

Research direction

Open wiremock-common/src/main/java/com/github/tomakehurst/wiremock/client/WireMock.java around loadMappingsFrom(...) and compare it with static delegations such as reset() and verify(). Add the corresponding static default-instance wrappers for the loadMappingsFrom overloads described in the issue. Done means default-instance users can load mappings without recreating a WireMock instance, with the relevant existing tests passing.

Written by the indexing model from the issue text.

Description

enhancement
Proposal

Add static wrapper methods for loadMappingsFrom(...) in WireMock.java, similar to other static methods that operate on the default WireMock instance - e.g:

public static void loadMappingsFrom(String path) {
    defaultInstance.get().loadMappingsFrom(path);
}

This would align with existing static delegation methods like reset(), verify(), etc., and make default-instance usage more consistent and ergonomic — especially for lightweight tooling and dynamic mapping workflows. Happy to contribute a PR for this if it’s considered useful.

Use Case

I'm using:

  • org.wiremock.integrations:wiremock-spring-boot:3.10.0
  • (which uses org.wiremock:wiremock:3.13.0)

…to build a small tool that records and replays WireMock mappings for integration testing.

In recording mode, I use the existing static methods like WireMock.startRecording(...), which work well with the default WireMock instance.

In playback mode, I want to programmatically load previously recorded mappings using loadMappingsFrom(...). However, there's currently no static method for this, and the default WireMock instance is not publicly accessible — so I can't load mappings unless I manually recreate the instance (which requires knowing the host/port).

References

No response

Dominant language
Java
Stars
7.4k
Forks
1.5k
Avg merge
13h 10m
Merged PRs (30d)
16

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wiremock/wiremock

All issues in wiremock/wiremock

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.