diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java index 530324d42b..3e2fda8bed 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java @@ -519,16 +519,13 @@ public interface WebClient { * scenarios, for example to decode the response differently depending * on the response status: *
- * Mono<Object> entityMono = client.get()
+ * Mono<Person> entityMono = client.get()
* .uri("/persons/1")
* .accept(MediaType.APPLICATION_JSON)
* .exchangeToMono(response -> {
* if (response.statusCode().equals(HttpStatus.OK)) {
* return response.bodyToMono(Person.class);
* }
- * else if (response.statusCode().is4xxClientError()) {
- * return response.bodyToMono(ErrorContainer.class);
- * }
* else {
* return response.createError();
* }
@@ -551,18 +548,15 @@ public interface WebClient {
* scenarios, for example to decode the response differently depending
* on the response status:
*
- * Mono<Object> entityMono = client.get()
+ * Flux<Person> entityMono = client.get()
* .uri("/persons")
* .accept(MediaType.APPLICATION_JSON)
* .exchangeToFlux(response -> {
* if (response.statusCode().equals(HttpStatus.OK)) {
* return response.bodyToFlux(Person.class);
* }
- * else if (response.statusCode().is4xxClientError()) {
- * return response.bodyToMono(ErrorContainer.class).flux();
- * }
* else {
- * return response.createException().flux();
+ * return response.createError().flux();
* }
* });
*
diff --git a/src/docs/asciidoc/web/webflux-webclient.adoc b/src/docs/asciidoc/web/webflux-webclient.adoc
index afa104ea8f..116480f985 100644
--- a/src/docs/asciidoc/web/webflux-webclient.adoc
+++ b/src/docs/asciidoc/web/webflux-webclient.adoc
@@ -582,17 +582,13 @@ depending on the response status:
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
.Java
----
- Mono