-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java system properties can not be applied to RestTemplate HttpClient connection in some cases #35815
Comments
While it does appear that behavior changed with 3.1 in this regard, the fact that previous releases allowed system properties to be applied in some cases but not others (for example, when Marking this for team attention to see what other think. |
I agree with you Scott. We should restore old behavior and fix the inconsistencies in earlier versions. |
I am new to Open Source Contributor. Shall i work on this issue? |
Thanks for the offer, @p-palanisami, but this issue is already assigned to @scottfrederick. I'm not sure if we have any at the moment, but please keep an eye out for unassigned issues labelled with ideal for contribution or, as your haven't contributed before, first-timers only. |
Spring boot 3.1.0
RestTemplateBuilder
with apache HTTP client in classpath (org.apache.httpcomponents.client5:httpclient5
) ignore java system HTTP proxy command line options like-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8888
.Spring boot before 3.1 respects such settings.
For simple
RestTemplate restTemplate = restTemplateBuilder.build()
spring boot 2.7 instantiate HttpComponentsClientHttpRequestFactory via default constructor, which create HTTP client asHttpClients.createSystem()
, i.e. with system proxy support.Spring boot 3.0 (if readTimeout duration is not set) also create HttpComponentsClientHttpRequestFactory via default constructor and HTTP client as
HttpClients.createSystem()
.But spring boot 3.1 create HTTP client as
HttpClientBuilder.create().setConnectionManager(connectionManager).build()
. WithoutuseSystemProperties()
asHttpClients.createSystem()
makes.Suggestion: add useSystemProperties() to createHttpClient method like this
For compatibility with spring boot 2.x, 3.0, and core spring HttpComponentsClientHttpRequestFactory.
The text was updated successfully, but these errors were encountered: