You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the the auto-detected HTTP client does not meet your needs, you can use the configprop:spring.http.client.factory[] property to pick a specific factory.
213
+
For example, if you have Apache HttpClient on your classpath, but you prefer Jetty's `HttpClient` you can add use the following:
214
+
215
+
[configprops,yaml]
216
+
----
217
+
spring:
218
+
http:
219
+
client:
220
+
factory: jetty
221
+
----
222
+
223
+
You can also set properties to change defaults that will be applied to all clients.
224
+
For example, you may want to change timeouts and if redirects are followed:
225
+
226
+
[configprops,yaml]
227
+
----
228
+
spring:
229
+
http:
230
+
client:
231
+
connect-timeout: 2s
232
+
read-timeout: 1s
233
+
redirects: dont-follow
234
+
----
235
+
236
+
For more complex customizations, you can declare your own `ClientHttpRequestFactoryBuilder` bean which will cause auto-configuration to back off.
237
+
This can be useful when you need to customize some of the internals of the underlying HTTP library.
238
+
239
+
For example, the following will use a JDK client configured with a specific `java.net.ProxySelector`:
240
+
241
+
include-code::MyClientHttpConfiguration[]
200
242
201
-
If multiple clients are available on the classpath, the most preferred client will be used.
0 commit comments