I want to handle standard http errors the same way. How can I do it with Spring WebClient
? Instead of hanging status check on each call below
webClient.get()
.uri("http://localhost:8081/resource")
.retrieve()
.onStatus(HttpStatus::isError, clientResponse -> {
// some error handling logic
})
.bodyToMono(MyPojo.class);
Solution based on @akreddy.21's comment
Add ExchangeFilterFunction.ofResponseProcessor
filter to webclient on bean creation where you can write common error handling logic for all webservice calls.