Questions tagged [spring-webclient]

WebClient makes it possible to perform reactive non-blocking HTTP requests in Spring applications. Use this tag for any questions involving its usage.

992 questions
6
votes
1 answer

spring-cloud-loabalancer configuring static server list

We're moving away from the spring-cloud Netflix OSS ecosystem one step at a time. Currently we're implementing spring-cloud-loadbalancer and removing Ribbon. However we used to have a lot of static services in our integration tests, now with the…
J.Pip
  • 4,523
  • 7
  • 31
  • 49
6
votes
3 answers

Webclient + Jackson: how to setup deserialization to convert snake_case into camelCase?

I'd like to avoid having to prefix my attributes with @JsonProperty("property_name") and instead just setup the Spring WebClient builder to convert all snake_cases into camelCases. Is that possible?
bpereira
  • 966
  • 2
  • 11
  • 29
6
votes
1 answer

How to handle HTTP status code in Spring Webclient

I'm stuck trying to do simple error handling when calling a remote service. The service returns a Map. The behaviour I'm looking for is: HTTP 200 --> Return body (Map). HTTP 500 --> Throw a particular exception HTTP 404 --> Simply…
tggm
  • 973
  • 2
  • 15
  • 41
6
votes
1 answer

Return null or something nullable from lambda in transformation mehtod WebFlux

In a Spring WebFlux chain I use a map operation which sometimes may return null and I get a warning : Return null or something nullable from lambda in transformation mehtod. I believe when data is null it doesn't actually map input to null but it…
alizeyn
  • 2,300
  • 1
  • 20
  • 30
6
votes
0 answers

How to read huge file from response using Flux?

In my project , there is a need to download file from external service and store it in some path. So I was using RestTemplate in spring to download file as Byte[] . But then this operation is costing me memory consumption. I found out in this blog…
6
votes
2 answers

How to test Spring WebClient retry when?

I need to implement following behavior: Make a REST post request If response returns with a status 429 Too many requests, retry up to 3 times with a delay of 1 second If the third retry fails or any other error occurs, log and write something to…
6
votes
2 answers

WebClient maxConnection pool limit?

How many concurrent requests can I send if the remote service if blocking? Means: what is the maxConnection pool limit that spring uses internally when using WebClient? @Autowired private WebClient…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
6
votes
2 answers

How to create Spring WebClient from Apache Http Client

I want to create WebClient from HttpComponent's org.apache.http.client.HttpClient to use it in async operations.Any idea on how to do it
5
votes
2 answers

Handling errors from Spring WebClient in another method

In a Spring Boot application, I'm using WebClient to invoke a POST request to a remote application. The method currently looks like this: // Class A public void sendNotification(String notification) { final WebClient webClient =…
Robert Strauch
  • 12,055
  • 24
  • 120
  • 192
5
votes
2 answers

BodyInserters.fromObject is deprecated, what is the alternative?

Helllo. I am trying to use Spring webclient to send post requests and fill the body with an object. But I receive the following " 'fromObject(T)' is deprecate". What is the alternative then ? WebClient.post() .uri("example.com") …
Hosten
  • 138
  • 1
  • 11
5
votes
1 answer

Webflux WebClient retry and Spring Cloud Circuit Breaker Resilience4J Retry pattern walk into a bar

Would like to ask a question about two technologies. We first started with an application that has to call other third parties rest API, hence, we used the Webflux WebClient in our SpringBoot Webflux project. So far so good, we had a successful app…
PatPanda
  • 3,644
  • 9
  • 58
  • 154
5
votes
2 answers

Dynamically configure scope for client registrations with Spring Security 5 OAuth2.0

I want to dynamically change scope for client registrations. I know how to set up registrations this way: spring: security: oauth2: client: registration: custom: client-id: clientId …
5
votes
1 answer

Cancel signal (close connection) what could be the cause?

In Kibana of our application, I keep seeing this line of log from org.springframework.web.reactive.function.client.ExchangeFunctions: [2f5e234b] Cancel signal (to close connection) The thread is reactor-http-epoll-1 or so. It could happen in two…
WesternGun
  • 11,303
  • 6
  • 88
  • 157
5
votes
1 answer

Enable Spring webclient to communicate on HTTPS with other TLS enabled services

I have 2 services A & B which should communicate over with each other over HTTPS. I have enabled TLS using server.ssl.* properties of Spring boot for both the applications. I am using WebClient for the communication where Service A will call B using…
humbleCoder
  • 667
  • 14
  • 27
5
votes
1 answer

Downloading file using Spring Webclient, file is empty

I'm supposed to download a ZIP file from 3rd party API. However, when I'm using Spring Webclient I end up with an empty file. Any ideas what I'm doing wrong? What is the proper way to store the content of Flux to a file? Here's my…
Endrew
  • 157
  • 1
  • 2
  • 12