We should introduce a @ConfigurationProperties bean for [RestClient|RestTemplate|WebClient]AutoConfiguration.

@ConfigurationProperties("spring.http.client")
public class HttpClientProperties {

    private Duration connectTimeout = Duration.ofSeconds(5);

    private Duration readTimeout = Duration.ofSeconds(30);

    private Redirects redirects = Redirects.FOLLOW_WHEN_POSSIBLE;

    private Class<? extends ClientHttpRequestFactory> requestFactoryType = JdkClientHttpRequestFactory.class;

    ...

}

Comment From: quaff

I would like to prepare an PR if the team accepts the proposal.

Comment From: wilkinsona

Apologies if I have have misunderstood the proposal, but don't we already have this?

Comment From: quaff

My apologies, I didn't notice that.

Comment From: quaff

But I think we should specify sensible default timeout, “Infinity” is a very bad default timeout.

Comment From: wilkinsona

I don't think it is infinity, at least not in all cases as it depends on the underlying client. For example, the Apache HTTP client has default connect and read timeouts of 3 minutes. Generally speaking, we prefer to keep each client's defaults as any differences may part of the reason why someone has chosen a particular client. Redirects are an exception to this as we wanted the upgrade experience to be as smooth as possible.