Skip to content

Provide configuration properties for common low-level HTTP client settings #47904

@miller79

Description

@miller79

Currently, configuring implementation-specific properties for HTTPClient instances—such as idleTimeout or maxConnections—requires custom logic like this:

    @Bean
    public RestClientCustomizer restClientBuilderCustomizer() {
        CloseableHttpClient pooledHttpClient = ...
        ... //Configure the properties here
        return builder -> builder.requestFactory(new HttpComponentsClientHttpRequestFactory(pooledHttpClient));
    }

While I understand the reasoning for not exposing every possible setting for every HTTP client implementation, there are several common properties that could be standardized at a higher level:

  • maxConnections
  • maxIdleTimeBeforeEviction (when pooling)
  • maxLifetime
  • keepAlive

These settings are widely applicable across implementations and align closely with what developers expect from other resource pools (e.g., database connection pools).

Libraries like RestEasy have already introduced similar high-level configuration options for their consumers, which simplifies tuning and promotes consistency.

I did a quick search through existing issues and couldn’t find prior discussion on why this hasn’t been considered. I’m curious about the community’s thoughts on introducing a standardized way to configure these common properties across HTTP client implementations.

Edit:

I have created a repository to show the common configs that would be nice to add and how they are configured currently with Apache and Reactor.

https://github.com/miller79/sample-httpclient-configurations

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: team-meetingAn issue we'd like to discuss as a team to make progressstatus: waiting-for-triageAn issue we've not yet triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions