Proposal: Add static loadMappingsFrom(...) methods in WireMock.java for default instance usage
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
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
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wiremock/wiremock
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
bug
Difficulty 2/5 Half a day Newbie friendliness 72/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
All issues in wiremock/wiremock
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100