Skip to content

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

Closed

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

Activity

  1. spring-projects-issues commented on Mar 17, 2015

    @spring-projects-issues
    CollaboratorAuthor

    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.

    Juergen

  2. spring-projects-issues commented on Mar 17, 2015

    @spring-projects-issues
    CollaboratorAuthor

    Jiri Mikulasek commented

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

    Jiri

  3. added
    type: enhancement
    in: web
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions