Is there a way with either client (RestTemplate or the newer WebClient) to set per destination socket or connect timeouts? For example in an API aggregation web service, where I talk to several different services/hosts, it's often desirable to have different socket timeouts based on if the services are internal or external/3rd party. The only solution I know of (with RestTemplate, I haven't used WebClient) is to instantiate a separate RestTemplate with a different socket timeout/connect timeout (and do this for each host that requires a different timeout).
This is fairly annoying because the amount of setup code required for a RestTemplate configured with HttpComponents is non-trivial, and having to add @Qualifier at every use of RestTemplate injection is also non-ideal. Further, the fact that HttpComponents allows for max total connections and max routes to host implies that one RestTemplate talking to all outbound traffic is the expected usage.