WebClient makes it possible to perform reactive non-blocking HTTP requests in Spring applications. Use this tag for any questions involving its usage.
Questions tagged [spring-webclient]
992 questions
4
votes
0 answers
reactive kafka consumer with webclient - no backpressure
I have a Spring Boot app using Reactor Kafka Consumer. The consumed messages must be sent to a webservice. Each HTTP request should contain x messages. After the webservice sends a HTTP response, I want to send the next request with the next x…

Raman
- 548
- 1
- 7
- 17
4
votes
1 answer
Spring Webflux how to Mock response as Mono.error for WebClient Junit
I am working on Spring WebFlux project,
I am calling third party API to create entity using WebClient.
I want to persist errors if WebClient is getting 4xx as reponse code.
Below is the code which is requesting third party API
API.java
import…

Alpesh Jikadra
- 1,692
- 3
- 18
- 38
4
votes
2 answers
Access Token Response: tokenType cannot be null
I am upgrading my service and implementing webclient using oAuth2, and I am getting exception is"tokenType cannot be null" could you please help me to resolve that.
exception:
org.springframework.security.oauth2.core.OAuth2AuthorizationException:…

pawan kumar
- 73
- 1
- 10
4
votes
1 answer
Is it possible to avoid calling CONNECT modifying HTTP proxy configuration while using WebClient?
During the migration of spring-web to spring-reactive-web, we blocked by the implementation of HTTP proxy at the WebClient builder method.
We already tried below code snippet earlier, which is referenced at How can I support an HTTP Proxy using…

Md. Hasan Basri
- 159
- 1
- 15
4
votes
4 answers
How to zip more than 8 mono using a combinator function
I'm enriching data by calling multiple web services for each item returned as the result of a previous webservice call (Ie - fanning out).
I'm using Kotlin, Spring Boot 2 and the new reactive WebClient.
In this snippet I'm showing just the code…

Ben Andersen-Waine
- 61
- 1
- 5
4
votes
1 answer
How to wait for subscribe to finish?
I want to make an asynchronous rest call for which I'm using spring webclient and getting back a Mono. I'm also doing some database calls in parallel but it can't be done reactively due to some reason.
Map models = new…

Heisenberg
- 5,514
- 2
- 32
- 43
4
votes
1 answer
Replacing RestTemplate with WebClient
I have a controller that uses RestTemplate to get data from several rest endpoints. Since RestTemplate is blocking, my web page is taking long time to load. In order to increase the performance, I am planning to replace all my usages of RestTemplate…

user9735824
- 1,196
- 5
- 19
- 36
4
votes
1 answer
Spring Webflux Webclient | Content type headers set issue
The way I'm setting header is below:
import org.springframework.web.reactive.function.client.WebClient;
WebClient webClient = WebClient.create();
webClient.post().uri(url)
.headers(httpHeaders -> httpHeaders.setAll(headersMap))
…

Neo
- 5,070
- 10
- 46
- 65
3
votes
1 answer
No qualifying bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' available
When I try to build my project, I get this error message:
: Unsatisfied dependency expressed through method 'webClient' parameter 0;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type…

surianto
- 47
- 1
- 8
3
votes
1 answer
"Timeout on blocking read" when using new Spring 6 HTTP Interface
We recently started testing the new HTTP Interface that came with Spring 6.
We defined a client like this:
HttpClient client = (HttpClient)((HttpClient)HttpClient.create().option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000)).doOnConnected((conn)…

Daniel
- 2,050
- 7
- 31
- 55
3
votes
0 answers
How to parse request.body for multipart file in django
I have used below code to post data to url
public void updateLogo(String clientKey, MultipartFile file) {
MultipartBodyBuilder builder = new MultipartBodyBuilder();
builder.part("file", file.getResource());
Settings prevData =…

Shiv
- 199
- 5
- 16
3
votes
1 answer
Upload a large TTL file to virtuoso graph
I am trying to write a ttl file to a graph in virtuoso using HTTP post call to the graph endpoint,
resource = new ClassPathResource("beil0.ttl").getFile();
String text = new String(Files.readAllBytes(resource.toPath()));
WebClient…

Naman Sharma
- 45
- 6
3
votes
1 answer
Proper form of a multipart request in Java webclient
So I'm trying to send a file over HTTP using Java's webclient and in addition to the file I want to send a mono with some info. Client side:
public int create(String filePath, String dirPath) {
File file = new File(filePath);
byte[]…

Barak Sason Rofman
- 39
- 6
3
votes
1 answer
How to avoid Mono#block() when using reactive in rest API logic
So the problem is as follows:
I am exposing API to register user within my service
Before I am going to register user, I want to validate him in external service (rest API)
I want to inform user with proper response status whether he was created…

Zychoo
- 625
- 2
- 8
- 25
3
votes
1 answer
Netty Webclient memory leak in spring boot
Hi all we are seeing app crash under heavy load when we analyze our heap dump major memory is taken by netty below the following leak suspect
218,618,256 bytes (63.15 %) of Java heap is used by 24 instances of io/netty/buffer/PoolArena$HeapArena
…

Nisarg Bhagavantanavar
- 243
- 3
- 16