Description
Rossen Stoyanchev opened SPR-17179 and commented
Currently the default constructor of JettyClientHttpConnector
creates a new HttpClient
instance. Arguably this is a little too easy, since unless the connector is re-used across WebClient
instances, each will be created with its own resources.
We should instead provide help with creating a Spring-managed Jetty HttpClient
instance that can then be shared among clients, and whose resources could also then be shared with a Jetty server (e.g. with WebFlux in non-blocking mode).
The proposed changes are to remove SmartLifecycle
from JettyClientHttpConnector
and create a JettyHttpClientFactory
instead hat manages an HttpClient
instance within a Spring ApplicationContext
. The connector would then accept a JettyHttpClientFactory
or an HttpClient
instance.
This would also be consistent with the changes for the ReactorClientHttpConnector
as part of #21501.
Affects: 5.1 RC1
Issue Links:
- Jetty HTTP client integration with WebClient [SPR-15092] #19658 Jetty HTTP client integration with WebClient
- Make it easier to tidy up the resources used by a WebClient [SPR-16963] #21501 Make it easier to tidy up the resources used by a WebClient