From 69416e2ca08dd4a9a81a4952a9ec3f7d74c69acb Mon Sep 17 00:00:00 2001 From: Tom Frenken Date: Tue, 28 Nov 2023 11:06:46 +0100 Subject: [PATCH 1/4] use system properties in rest template --- .../boot/web/client/ClientHttpRequestFactories.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java index 9f4aa4475487..b2f637b8d6d3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java @@ -31,7 +31,6 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import okhttp3.OkHttpClient; import org.apache.hc.client5.http.classic.HttpClient; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager; @@ -42,7 +41,6 @@ import org.eclipse.jetty.client.transport.HttpClientTransportDynamic; import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.util.ssl.SslContextFactory; - import org.springframework.boot.context.properties.PropertyMapper; import org.springframework.boot.ssl.SslBundle; import org.springframework.boot.ssl.SslOptions; @@ -57,6 +55,9 @@ import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; +import okhttp3.OkHttpClient; + + /** * Utility class that can be used to create {@link ClientHttpRequestFactory} instances * configured using given {@link ClientHttpRequestFactorySettings}. @@ -212,7 +213,7 @@ private static HttpClient createHttpClient(Duration readTimeout, SslBundle sslBu options.getEnabledProtocols(), options.getCiphers(), new DefaultHostnameVerifier()); connectionManagerBuilder.setSSLSocketFactory(socketFactory); } - PoolingHttpClientConnectionManager connectionManager = connectionManagerBuilder.build(); + PoolingHttpClientConnectionManager connectionManager = connectionManagerBuilder.useSystemProperties().build(); return HttpClientBuilder.create().useSystemProperties().setConnectionManager(connectionManager).build(); } From 9229f79f12b5a6b4c9dc0944e3a234111796be36 Mon Sep 17 00:00:00 2001 From: Tom Frenken Date: Tue, 28 Nov 2023 15:43:11 +0100 Subject: [PATCH 2/4] remove redundant diff --- .../boot/web/client/ClientHttpRequestFactories.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java index b2f637b8d6d3..edbce196908f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java @@ -31,6 +31,7 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; +import okhttp3.OkHttpclient; import org.apache.hc.client5.http.classic.HttpClient; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager; @@ -41,6 +42,7 @@ import org.eclipse.jetty.client.transport.HttpClientTransportDynamic; import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.util.ssl.SslContextFactory; + import org.springframework.boot.context.properties.PropertyMapper; import org.springframework.boot.ssl.SslBundle; import org.springframework.boot.ssl.SslOptions; @@ -55,8 +57,6 @@ import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; -import okhttp3.OkHttpClient; - /** * Utility class that can be used to create {@link ClientHttpRequestFactory} instances From a0abe526472dc6f46e5e546c1255825ec6ba4c11 Mon Sep 17 00:00:00 2001 From: Tom Frenken Date: Tue, 28 Nov 2023 15:43:52 +0100 Subject: [PATCH 3/4] remove redundant diff --- .../boot/web/client/ClientHttpRequestFactories.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java index edbce196908f..08306d4a2143 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java @@ -31,7 +31,7 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import okhttp3.OkHttpclient; +import okhttp3.OkHttpClient; import org.apache.hc.client5.http.classic.HttpClient; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager; @@ -57,7 +57,6 @@ import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; - /** * Utility class that can be used to create {@link ClientHttpRequestFactory} instances * configured using given {@link ClientHttpRequestFactorySettings}. From 196d7f1bb0d91199bbbe446c1e84ff80cc91ab0e Mon Sep 17 00:00:00 2001 From: Tom Frenken Date: Tue, 28 Nov 2023 17:09:58 +0100 Subject: [PATCH 4/4] run format --- .../boot/web/client/ClientHttpRequestFactories.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java index 08306d4a2143..9fc047382ff3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/ClientHttpRequestFactories.java @@ -212,7 +212,8 @@ private static HttpClient createHttpClient(Duration readTimeout, SslBundle sslBu options.getEnabledProtocols(), options.getCiphers(), new DefaultHostnameVerifier()); connectionManagerBuilder.setSSLSocketFactory(socketFactory); } - PoolingHttpClientConnectionManager connectionManager = connectionManagerBuilder.useSystemProperties().build(); + PoolingHttpClientConnectionManager connectionManager = connectionManagerBuilder.useSystemProperties() + .build(); return HttpClientBuilder.create().useSystemProperties().setConnectionManager(connectionManager).build(); }