title: WireMock not intercepting http request with Spring boot Integration Test
body: <p>I have Sprint Boot Integration test with Wiremock but for some reason the Wiremock is not serving the stub response and the http request is going out to actual external api. Am I missing something? I can see from logs that the Wiremock server is starting on port 8888</p>
  <pre><code>   &lt;dependency&gt;
          &lt;groupId&gt;com.github.tomakehurst&lt;/groupId&gt;
          &lt;artifactId&gt;wiremock-jre8-standalone&lt;/artifactId&gt;
          &lt;version&gt;2.27.0&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
  
  
  @RunWith(SpringRunner.class)
  @SpringBootTest(classes = GatewayApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
  public class RegTypeIntegratedTest {
  
      @LocalServerPort
      private int port;
  
      TestRestTemplate restTemplate = new TestRestTemplate();
      HttpHeaders headers = new HttpHeaders();
      ObjectMapper mapper = new ObjectMapper();
  
      @Rule
      public WireMockRule wireMockRule = new WireMockRule(options().port(8888));
  
  
      @Test
      public void testRegType()
              throws JSONException, JsonParseException, JsonMappingException, FileNotFoundException, IOException {
  
          wireMockRule.stubFor(post(urlPathMatching(&quot;{path}/.*/&quot;)).willReturn(
                  aResponse().withHeader(&quot;Content-Type&quot;, &quot;application/json&quot;).withBody(new String(Files.readAllBytes(
                          Paths.get(&quot;path/regtypeResponse_stub.json&quot;))))));
  
  
          HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;(null, headers);
  
          ResponseEntity&lt;String&gt; response = restTemplate.exchange(
                  createURLWithPort(&quot;/{service-url-path}y/regTypes?regtype=I&quot;), HttpMethod.GET, entity,
                  String.class);
  
          String expected = new String(Files
                  .readAllBytes(Paths.get(&quot;path/regtypeResponse_expected.json&quot;)));
  
          JSONAssert.assertEquals(expected, response.getBody(), true);
      }
  
      private String createURLWithPort(String uri) {
          return &quot;http://localhost:&quot; + port + uri;
      }
  }
  </code></pre>