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

Provide a way to further customize underlying ClientHttpRequestFactory components #39035

Closed
ciscoo opened this issue Jan 4, 2024 · 2 comments
Assignees
Labels
theme: http-client-config Issues related to configuration of HTTP clients type: enhancement A general enhancement
Milestone

Comments

@ciscoo
Copy link

ciscoo commented Jan 4, 2024

I could not find a way to further modify the PoolingHttpClientConnectionManagerBuilder (or HttpClientBuilder) that Spring Boot creates without essentially duplicating Spring Boot defaults and then applying customizations.

Spring Cloud OpenFeign had properties which further customized the client. For example, to configure the pool connection policy.

Ideally, I would like to declare a customizer bean of some sort:

@FunctionalInterface
public interface PoolingHttpClientConnectionManagerBuilderCustomizer {
	
	void customize(PoolingHttpClientConnectionManagerBuilder connectionManagerBuilder);
}

Or if there were some static factory method that created a base PoolingHttpClientConnectionManagerBuilder that I could use and then further customize as needed.

Alternatively, you could provide more configuration properties like the Feign project, but I think that would quite the added overhead since they would different per HTTP client.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 4, 2024
@philwebb
Copy link
Member

philwebb commented Jan 8, 2024

I think we'd need some changes to org.springframework.boot.web.client.ClientHttpRequestFactories to be able to support this and I'm not sure how to do that in a generic fashion.

We currently have static get methods that accept ClientHttpRequestFactorySettings, I guess we'd need to also accept some kind of customizer, but it's hard to see what the interface could be since we'd ideally like to keep it generic.

Flagging for team attention to see if anyone has any bright ideas.

@philwebb philwebb added the for: team-attention An issue we'd like other members of the team to review label Jan 8, 2024
@scottfrederick
Copy link
Contributor

scottfrederick commented Jan 8, 2024

I think #38920 is related, in that both issues involve finer-grained customization of the underlying HTTP client being used by RestTemplate, RestClient, or WebClient after Spring Boot has applied any auto-configuration.

In addition, we should keep in mind the issues reported in #36263 and #36594.

@scottfrederick scottfrederick added the theme: http-client-config Issues related to configuration of HTTP clients label Jan 9, 2024
@philwebb philwebb added type: enhancement A general enhancement and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged labels Feb 15, 2024
@philwebb philwebb added this to the 3.x milestone Feb 15, 2024
@philwebb philwebb changed the title Provide a way to further customize underlying components for request factory for RestClient Provide a way to further customize underlying HttpComponentsClientHttpRequestFactory components Oct 26, 2024
@philwebb philwebb self-assigned this Oct 26, 2024
@philwebb philwebb modified the milestones: 3.x, 3.4.0-RC1 Oct 26, 2024
@philwebb philwebb changed the title Provide a way to further customize underlying HttpComponentsClientHttpRequestFactory components Provide a way to further customize underlying ClientHttpRequestFactory components Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: http-client-config Issues related to configuration of HTTP clients type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants