spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.67k stars 38.15k forks source link

RestClient : interceptors are executed 2 times #32196

Closed rawadolb closed 9 months ago

rawadolb commented 9 months ago

Describe the bug When RestCient is initialized by a RestTemplate using RestClient.builder(restTemplate) the interceptors are executed 2 times.

To Reproduce Create a RestTemplate with an interceptor (loggingInterceptor to make it simple). Initialize a RestClient and then perform a call restClient.get().uri(uri).retrieve().body(YourObject.class) LoggingInterceptor will be executed 2 times because 2 ClientHttpRequestInterceptor object are created. (Please find attached)

Expected behavior The interceptor must be executed once

image

jhoeller commented 9 months ago

This should be fixed in 6.1.4 snapshots already: #32038