Skip to content

HttpComponentsClientHttpRequestFactory should not depend on CloseableHttpClient [SPR-12826] #17423

Closed
@spring-projects-issues

Description

@spring-projects-issues

Jiri Mikulasek opened SPR-12826 and commented

This dependency makes spring rest client support unusable for cases, where only bare implementation of HttpClient interface is needed - i.e. we have custom HttpClient - wrapper, for which is not useful to extend CloseableHttpClient (in the opposite it would complicate and mess all that thing).

I also believe it is bad practice to rely on abstract classes instead of interfaces.

Please consider to depend only on the HttpClient interface and implement the "closing logic" only for clients which also implements Closeable.

Well, I know I can provide custom ClientHttpRequestFactory for RestTemplate and it could be a workaround, but to do that I need to reimplement also HttpClientRequest and Response and whole the thing would be copy&paste from your code with only small change.


Affects: 4.1.5

Issue Links:

Referenced from: commits 370e3a5

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