From 3c3d3f7b19beaee1908c00063e906ddef522bc71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=8D=9A=20=28Yang=20Bo=29?= Date: Wed, 12 Dec 2018 02:47:52 +0800 Subject: [PATCH] Configure for WireMockServer instead of port (#812) When port = 0, WireMock will assign different ports for admin server and mock server. As a result, the original implementation will send admin requests to mock server, which is wrong behavior. If this PR got merged, WireMock will directly add stubs instead of sending admin requests, which is correct behavior and also improves performance. --- .../cloud/contract/wiremock/WireMockConfiguration.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/WireMockConfiguration.java b/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/WireMockConfiguration.java index 67bc1423ed..14b0ce135c 100644 --- a/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/WireMockConfiguration.java +++ b/spring-cloud-contract-wiremock/src/main/java/org/springframework/cloud/contract/wiremock/WireMockConfiguration.java @@ -162,7 +162,7 @@ public class WireMockConfiguration implements SmartLifecycle { @Override public void start() { this.server.start(); - WireMock.configureFor("localhost", this.server.port()); + WireMock.configureFor(new WireMock(this.server)); this.running = true; if (log.isDebugEnabled()) { log.debug("Started WireMock at port [" + this.server.port() + "]. It has [" @@ -287,4 +287,4 @@ class WireMockProperties { } -} \ No newline at end of file +}