Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

spring-issuemaster opened this issue Mar 17, 2015 · 2 comments


None yet
2 participants
Copy link

commented Mar 17, 2015

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:

  • #17184 Merge default request config with local customizations
  • #20223 Support CachingHttpAsyncClient from httpasyncclient-cache in HttpComponentsAsyncClientHttpRequestFactory

Referenced from: commits 370e3a5


This comment has been minimized.

Copy link
Collaborator Author

commented Mar 17, 2015

Juergen Hoeller commented

Good point, I'm about to revise our implementation accordingly, considering the Closeable / CloseableHttpClient type as an option only and therefore being able to work with plain HttpClient implementations as well. This will be available in tomorrow's 4.2 snapshot.



This comment has been minimized.

Copy link
Collaborator Author

commented Mar 17, 2015

Jiri Mikulasek commented

Thanks for really quick response - I just tested the nightly SNAPSHOT with our HttpClient wrapper and it worked smoothly.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.