using a Flux and flatMap will do all requests async, then you collectList and block to get the list of strings.
List<Strings> strings = Flux.fromIterable(dataList)
.flatMap(data -> webclient.post( ... )
.bodyValue(data)
.retreive()
.bodyToMono(String.class))
.collectList()
.block();
Answer from Toerktumlare on Stack OverflowLogicBig
logicbig.com › tutorials › spring-framework › spring-webflux › web-client.html
Spring 5 - WebClient Example
public class WebClientExample2 { public static void main(String[] args) throws InterruptedException { WebClient webClient = WebClient.create("http://localhost:8080"); Mono<String> result = webClient.get() .retrieve() .bodyToMono(String.class); result.subscribe(WebClientExample2::handleResponse); System.out.println("After subscribe"); //wait for a while for the response Thread.sleep(1000); } private static void handleResponse(String s) { System.out.println("handle response"); System.out.println(s); } }
HowToDoInJava
howtodoinjava.com › home › spring webflux › spring webclient (with hands-on examples)
Spring WebClient (with Hands-On Examples)
September 14, 2023 - Mono<ClientResponse> responseMono = webClient.get() .uri("/employees/{id}", 123) .exchange(); responseMono.subscribe(clientResponse -> { HttpStatus statusCode = clientResponse.statusCode(); // HTTP Status HttpHeaders headers = clientResponse.headers(); // HTTP Headers Mono<Employee> employeeMono = clientResponse.bodyToMono(Employee.class); // Response Body // Handle the response, including error handling based on status code }); Here’s an example of how to use exchangeToMono() to make a GET request with Spring WebClient and handle the response: @Service public class MyService { private final
Packt Publishing
hub.packtpub.com › implementing-a-non-blocking-cross-service-communication-with-webclienttutorial
Implementing a non-blocking cross-service communication with WebClient[Tutorial]
February 13, 2019 - Here, we use the bodyToMono method, which converts the incoming payload of the User to Mono, shown at point (5). Finally, we can build the processing flow of the incoming response using the Reactor API, and execute the remote call by calling the subscribe method. WebClient follows the behavior described in the Reactive Streams specification.
Medium
medium.com › @shivibh › reactive-error-and-response-handling-with-spring-webclient-a-deep-dive-cd476105d885
Reactive Error and Response Handling with Spring WebClient: A Deep Dive | by Shivi Bhardwaj | Medium
October 9, 2024 - Spring WebClient, part of Spring WebFlux, offers a reactive and non-blocking approach to making HTTP calls, allowing your application to handle asynchronous tasks efficiently. This post will explore how to handle responses and errors reactively, using WebClient, and demonstrate the subscribe and publish patterns for managing both success and failure scenarios.
Baeldung
baeldung.com › home › spring › spring web › spring webclient
Spring WebClient | Baeldung
November 25, 2025 - Keep in mind that if we defined a default base URL for the WebClient, this last method would override this value. Then we can set a request body, content type, length, cookies, or headers if we need to. For example, if we want to set a request body, there are a few available ways.
Medium
medium.com › @pradeepisuru31 › mastering-spring-webclient-a693f90447f0
Mastering Spring WebClient. A Comprehensive Guide for… | by Isuru Pradeep | Medium
June 22, 2025 - @Bean public WebClient webClient() { return WebClient.builder() .baseUrl("https://api.example.com") .clientConnector(new ReactorClientHttpConnector( HttpClient.create().followRedirect(true) )) .build(); } Mono<User> user = webClient.get() .uri("/users/{id}", 123) .retrieve() .bodyToMono(User.class); // Async handling (non-blocking) user.subscribe( response -> System.out.println("User: " + response), error -> System.err.println("Error: " + error) ); Flux<User> users = webClient.get() .uri("/users") .retrieve() .bodyToFlux(User.class); users.subscribe( user -> System.out.println("Received: " + u
Baeldung
baeldung.com › home › spring › spring webflux › execute synchronous requests using webclient
Execute Synchronous Requests Using WebClient | Baeldung
September 4, 2024 - When sending an HTTP request, WebClient returns one of two reactive data types from the Reactor Core library – Mono or Flux. These return types represent streams of data, where Mono corresponds to a single value or an empty result, and Flux refers to a stream of zero or multiple values. Having an asynchronous and non-blocking API lets the caller decide when and how to subscribe, keeping the code reactive.
HowToDoInJava
howtodoinjava.com › home › spring webflux › spring boot webclient post example
Spring Boot WebClient POST Example
September 14, 2023 - Then we can submit the multipart form data by using the method BodyInserters.fromMultipartData(builder.build()) and send a normal request as in the previous examples. webClient.post() .uri("/employees") .contentType(MediaType.MULTIPART_FORM_DATA) .body(BodyInserters.fromMultipartData(builder.build())) .retrieve() .toEntity(Employee.class) .doOnError(WriteTimeoutException.class, ex -> { System.err.println("WriteTimeout"); }) .subscribe(responseEntity -> { System.out.println("Status: " + responseEntity.getStatusCode().value()); System.out.println("Location URI: " + responseEntity.getHeaders().getLocation().toString()); System.out.println("Created New Employee : " + responseEntity.getBody()); }); Generally, there is no need to send the query parameters in a POST request.
CalliCoder
callicoder.com › home › topics › spring boot › spring webclient and webtestclient tutorial with examples
Spring WebClient and WebTestClient Tutorial with Examples | CalliCoder
November 14, 2017 - WebClient is Spring’s non-blocking HTTP client, introduced with the reactive stack and now the default recommendation for calling remote services. RestTemplate still works and is still maintained for bug fixes, but it receives no new features, so new code that talks HTTP should be using one of the fluent clients. Two things this guide covers that short examples skip: there is no response timeout unless you configure one, and retrieve() turns a 404 into a thrown exception whether or not you meant it to.
Piotr's TechBlog
piotrminkowski.wordpress.com › 2019 › 11 › 04 › using-reactive-webclient-with-spring-webflux
Using Reactive WebClient with Spring WebFlux – Piotr's TechBlog
November 4, 2019 - We can easily access it with non-blocking WebClient. The following test starts sample Spring WebFlux application, defines WebClient instance and subscribes to the response stream.