-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
This is similar to #36594 and #27360 but I'm not sure if a solution for those issues would also fix mine, so feel free to close this if you consider this to be a duplicate.
Issue: Configuration made through the spring.http.client
properties is ignored if I use AutoConfiguredRestClientSsl
. For example, configuration like
spring:
http:
client:
redirects: dont_follow
does not work if I also have this:
@Bean
RestClientCustomizer clientCertConfigurer(RestClientSsl restClientSsl) {
return builder -> builder.apply(restClientSsl.fromBundle("my-bundle"));
}
The reason for this is that AutoConfiguredRestClientSsl
replaces the request factory and thus discards any configuration made via the spring.http.client
properties:
Lines 52 to 56 in 1832852
return (builder) -> { | |
ClientHttpRequestFactorySettings settings = ClientHttpRequestFactorySettings.ofSslBundle(bundle); | |
ClientHttpRequestFactory requestFactory = this.clientHttpRequestFactoryBuilder.build(settings); | |
builder.requestFactory(requestFactory); | |
}; |
For this specific issue I can work around this by removing my RestClientCustomizer
and use
spring:
http:
client:
redirects: dont_follow
ssl:
bundle: "my-bundle"
instead, but this only works in this static scenario, if I needed some more sophisticated logic to determine the SSL bundle to use at runtime, this wouldn't work.