I'm trying out the new HTTP client enhancements made with 3.4.0 and noticed: * spring.http.client properties don't apply to auto-configured WebClient.Builder instances. * My ReactorNettyHttpClientMapper beans are not applied to the HttpClient created by ReactorClientHttpRequestFactoryBuilder.

I was hoping to be able to simplify my configuration by re-using the same (or rather identically configured) Reactor HttpClient instances across my WebClient and RestTemplate beans, but it looks like I still need to configure those separatedly.

Are there plans to harmonize the configuration to allow the new properties and existing customizers like ReactorNettyHttpClientMapper to apply globally to all auto-configured HTTP clients?

Related: * #43068 (mentions WebClient, but was closed as a duplicate). * #43079 (wants to use the new RequestFactoryBuilder approach for WebClient).

Comment From: wilkinsona

spring.http.client properties don't apply to auto-configured WebClient.Builder instances

This is to be expected and documented. The properties are for Spring's blocking HTTP clients only, naming RestTemplate and RestClient.

I was hoping to be able to simplify my configuration by re-using the same (or rather identically configured) Reactor HttpClient instances across my WebClient and RestTemplate beans, but it looks like I still need to configure those separatedly.

That's right. At the moment, ReactorNettyHttpClientMapper beans are only applied when creating the ReactorClientHttpConnector used by WebClient. As things stand, I think you could apply them yourself through ReactorClientHttpRequestFactoryBuilder.withHttpClientCustomizer(UnaryOperator<HttpClient>):

@Bean
ClientHttpRequestFactoryBuilder<?> clientHttpRequestFactoryBuilder(
        ObjectProvider<ReactorNettyHttpClientMapper> mappers) {
    ReactorClientHttpRequestFactoryBuilder reactor = ClientHttpRequestFactoryBuilder.reactor();
    mappers.forEach((mapper) -> reactor.withHttpClientCustomizer(mapper::configure));
    return reactor;
}

I think we can re-purpose this issue to investigate doing the above automatically when the auto-configured ClientHttpRequestFactoryBuilder is a ReactorClientHttpRequestFactoryBuilder.

Comment From: kzander91

@wilkinsona Thanks for the quick response, defining my own ClientHttpRequestFactoryBuilder is the workaround I'll be going with for now.