feign
feign copied to clipboard
Configuration in feign client does not affect
Greetings. Can you please help me figure out next problem? I use next dependency :
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>4.0.4</version>
I have multiply feign clients. These clients work by https . So I created bean Feign.Builder something like this pseudocode:
@Bean
public Feign.Builder feignBuilder() {
HostnameVerifier hostnameVerifier = (hostname, session) -> true;
return Feign.builder()
.client(new Client.Default(createSocketFactory(), hostnameVerifier));
}
Next moment is interceptor. I have interceptor
public class FooConfiguration {
@Bean
public RequestInterceptor fooInterceptor( {
... pseudocode
return interceptor;
}
}
finally feign client is
@FeignClient(name = "foo-client", url = "${foo-client.url}", configuration = FooConfiguration.class)
public interface FooFeignClient {
@PostMapping("/foo")
Dto findFoo(@RequestBody FooDto fooDto);
}
My problem is interceptor does not work and interceptor was not called. It seems like configuration is not applied when I use client with SSL. Also, I tested it without SSL -when I DONT USE Feign.Builder feignBuilder() it works correctly and Interceptor was triggered.
I use spring boot 3.1.4
How can I force an interceptor to work with SSL?
Based on the code in ResponseHandler.handleResponse(), decodeError() is thrown before decode() is called (which invokes the interceptor). So the interceptor is unused at the moment.