From 814369e38cf68f9e3ff428c92bca3f044520bcf2 Mon Sep 17 00:00:00 2001 From: Gerardo Roza Date: Fri, 22 Jan 2021 10:49:47 -0300 Subject: [PATCH] added exchange and retrieve examples as in teh article, updated due to deprecation --- .../baeldung/web/reactive/client/WebClientController.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java b/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java index 70919d8a2e..de4f20a13f 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java +++ b/spring-5-reactive/src/main/java/com/baeldung/web/reactive/client/WebClientController.java @@ -72,8 +72,12 @@ public class WebClientController { .ifNoneMatch("*") .ifModifiedSince(ZonedDateTime.now()) .retrieve(); - WebClient.ResponseSpec response2 = requestSpec2.retrieve(); - + String response2 = uri1.exchangeToMono(response -> response.bodyToMono(String.class)) + .block(); + String response3 = uri2.retrieve() + .bodyToMono(String.class) + .block(); + WebClient.ResponseSpec response4 = requestSpec2.retrieve(); } private WebClient createWebClient() {