title: How to consume spring web client response
body: <p>I am using web client in a spring application</p>
  <p>I am facing memory leak issues while doing the same</p>
  <p>I am using below code to get the response body for non 2XX response from service:</p>
  <pre><code>return client.get()
                  .uri(uriString)
                  .headers(ServiceCommonUtil.getHttpHeaderConsumer(headersMap))
                  .exchange()
                  .flatMap(clientResponse -&gt; {
                      try {
                          clientResponse.body((clientHttpResponse, context) -&gt;
                                  clientHttpResponse.getBody());
                          logResponseStatus(clientResponse.statusCode(), serviceName);
                          return clientResponse.bodyToMono(String.class);
                      } catch (Exception e) {
                          return null;
                      }
  
                  })
  </code></pre>
  <p>and later on subscriber uses subscribe/ error block to process this response.</p>
  <pre><code>responseMono.subscribe(response -&gt; {
      //process response string
  },error-&gt;{
      //process error response
  });
  </code></pre>
  <p>My question is, if i use dispose method on responseMono, it takes way long time for processing while without it i face memory leak issues.
  Am i doing anything wrong here?</p>