diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java index cb7c9cd075..5c6eaa0cf1 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java @@ -62,9 +62,11 @@ import org.springframework.web.reactive.function.BodyExtractor; *
NOTE: You must always use one of the body or - * entity methods of the response to ensure resources are released. - * See {@link ClientResponse} for more details. + *
NOTE: Unlike {@link #retrieve()}, when using
+ * {@code exchange()}, it is the responsibility of the application to
+ * consume any response content regardless of the scenario (success,
+ * error, unexpected data, etc). Not doing so can cause a memory leak.
+ * See {@link ClientResponse} for a list of all the available options
+ * for consuming the body. Generally prefer using {@link #retrieve()}
+ * unless you have a good reason to use {@code exchange()} which does
+ * allow to check the response status and headers before deciding how or
+ * if to consume the response.
* @return a {@code Mono} for the response
* @see #retrieve()
*/
diff --git a/src/docs/asciidoc/web/webflux-webclient.adoc b/src/docs/asciidoc/web/webflux-webclient.adoc
index 372255fcaf..2121f23c7e 100644
--- a/src/docs/asciidoc/web/webflux-webclient.adoc
+++ b/src/docs/asciidoc/web/webflux-webclient.adoc
@@ -496,17 +496,12 @@ Note that (unlike `retrieve()`), with `exchange()`, there are no automatic error
[CAUTION]
====
-When using `exchange()`, you have to make sure that the body is always consumed or released,
-even when an exception occurs (see <