From 761b37dbd9de37b6c31881edc243470990566cd3 Mon Sep 17 00:00:00 2001
From: buildmaster
public static WireMockClassRule wiremock = new WireMockClassRule( WireMockSpring.options().dynamicPort()); - // A service that calls out over HTTP to localhost:${wiremock.port} + @Before + public void setup() { + this.service.setBase("http://localhost:" + wiremock.port()); + } + + // A service that calls out over HTTP to wiremock's port @Autowired private Service service; diff --git a/single/spring-cloud-contract.html b/single/spring-cloud-contract.html index bdd4ee987c..022daf651c 100644 --- a/single/spring-cloud-contract.html +++ b/single/spring-cloud-contract.html @@ -6337,7 +6337,12 @@ instance, as shown in the following example:public static WireMockClassRule wiremock = new WireMockClassRule( WireMockSpring.options().dynamicPort()); - // A service that calls out over HTTP to localhost:${wiremock.port} + @Before + public void setup() { + this.service.setBase("http://localhost:" + wiremock.port()); + } + + // A service that calls out over HTTP to wiremock's port @Autowired private Service service; diff --git a/spring-cloud-contract.xml b/spring-cloud-contract.xml index c3d01ae948..d219f33a41 100644 --- a/spring-cloud-contract.xml +++ b/spring-cloud-contract.xml @@ -10062,7 +10062,12 @@ public class WiremockForDocsClassRuleTests { public static WireMockClassRule wiremock = new WireMockClassRule( WireMockSpring.options().dynamicPort()); - // A service that calls out over HTTP to localhost:${wiremock.port} + @Before + public void setup() { + this.service.setBase("http://localhost:" + wiremock.port()); + } + + // A service that calls out over HTTP to wiremock's port @Autowired private Service service;