Revisit resource cleanup in RestTemplate and ClientHttpRequestFactory #29010
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
See spring-projects/spring-boot#31075 (comment) for background.
The goal of this issue is to review contracts around
ClientHttpRequestFactory
resource management.These days,
RestTemplate
instances aren't contributed as beans to the application context. This trend also applies toWebClient
. As pointed out by the comment above, current usage patterns are not in line with how resources are supposed to be cleaned.As part of this issue, we should consider whether
ClientHttpRequestFactory
should extendCloseable
, and align all implementations with that change. As part of that, we should then review all places where request factories are instantiated in Framework; we might need to also makeHttpAccessor
extendCloseable
, since it's itself instantiating arequestFactory
.The text was updated successfully, but these errors were encountered: