I could not find a way to further modify the PoolingHttpClientConnectionManagerBuilder (or HttpClientBuilder) that Spring Boot creates without essentially duplicating Spring Boot defaults and then applying customizations.
Spring Cloud OpenFeign had properties which further customized the client. For example, to configure the pool connection policy.
Ideally, I would like to declare a customizer bean of some sort:
@FunctionalInterface
public interface PoolingHttpClientConnectionManagerBuilderCustomizer {
void customize(PoolingHttpClientConnectionManagerBuilder connectionManagerBuilder);
}
Or if there were some static factory method that created a base PoolingHttpClientConnectionManagerBuilder that I could use and then further customize as needed.
Alternatively, you could provide more configuration properties like the Feign project, but I think that would quite the added overhead since they would different per HTTP client.
Comment From: philwebb
I think we'd need some changes to org.springframework.boot.web.client.ClientHttpRequestFactories to be able to support this and I'm not sure how to do that in a generic fashion.
We currently have static get methods that accept ClientHttpRequestFactorySettings, I guess we'd need to also accept some kind of customizer, but it's hard to see what the interface could be since we'd ideally like to keep it generic.
Flagging for team attention to see if anyone has any bright ideas.
Comment From: scottfrederick
I think #38920 is related, in that both issues involve finer-grained customization of the underlying HTTP client being used by RestTemplate, RestClient, or WebClient after Spring Boot has applied any auto-configuration.
In addition, we should keep in mind the issues reported in #36263 and #36594.