Affects: org.springframework.boot:spring-boot:3.0.0-RC1


What are we trying to do ?

instantiate a RestTemplateBuilder while having org.apache.httpcomponents.client5:httpclient5 on the runtime classpath. (probable explanation in the end)

reproduce

https://gist.github.com/soft4rchitecture/729cf677a49d6d07a852aa22e1c9f830

expected result

the test succeeds

current result

the test fails with the following stack trace

preliminary explanations

org.springframework.boot.web.client.ClientHttpRequestFactorySupplier is called to supply a CLientHttpRequestFactory. If org.apache.hc.client5.http.impl.classic.HttpClients is on the class path, then org.springframework.http.client.HttpComponentsClientHttpRequestFactory is provided. HttpComponentsClientHttpRequestFactory actually has the setReadTimeout() method deprecated since 6.0. When org.springframework.boot.web.client.RestTemplateBuilder.RequestFactoryCustomizer#setReadTimeout calls org.springframework.http.client.HttpComponentsClientHttpRequestFactory#setReadTimeout then expection is thrown

Comment From: bclozel

Closing as a duplicate of https://github.com/spring-projects/spring-boot/issues/32857 Thanks!