Given a simple method such as
@GetExchange("/foo")
Mono<ResponseEntity<List<Foo>>> getFoos();
in FooInterface
, with a ‘standard’ WebClient backing it.
The factory is also ‘generic’:
HttpServiceProxyFactory factory = HttpServiceProxyFactory
.builderFor(WebClientAdapter.create(webClient))
.build();
return factory.createClient(FooInterface.class);
When the client is used and a 40X or 50X response occurs, then the WebClient throws a WebClientResponseException
– which is unexpected – as I would think that having specified Mono<ResponseEntity<List<Foo>>>
as the return type would have returned a ResponseEntity with status 40X or 50X.
The factory seems to prefer a retrieve
rather than an exchange
despite the annotation being GetExchange
.
I haven’t found a way to influence this behavior through configuration. It seems like a bug. I can change my code to respond to the exception and remap it to a ResponseEntity, but this seems strange to me.
I’m just starting to look at the Spring Web code for insight, but thought I’d throw it out to the experts. Is anyone familiar with how to set this up?
5