Skip to content

Revisit resource cleanup in RestTemplate and ClientHttpRequestFactory #29010

Closed
@bclozel

Description

@bclozel

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 to WebClient. 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 extend Closeable, 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 make HttpAccessor extend Closeable, since it's itself instantiating a requestFactory.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions