Skip to content

Adapt to HttpComponentClientHttpRequestFactory changes #32461

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

Closed
bclozel opened this issue Sep 21, 2022 · 1 comment
Closed

Adapt to HttpComponentClientHttpRequestFactory changes #32461

bclozel opened this issue Sep 21, 2022 · 1 comment
Assignees
Labels
status: noteworthy A noteworthy issue to call out in the release notes type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Sep 21, 2022

As of spring-projects/spring-framework#28925, Spring Framework doesn't configure the Apache HttpComponents client 4.x, as this generation is not maintained anymore. The implementation has switched to using the httpclient5 generation.

Besides adapting our auto-configuration and various tests, we also need to consider:

The 5.1.x documentation has interesting bits of documentation about migrating to the "classic" API as well as typical client usage examples.

This change should be reflected in our own migration guide.

@bclozel bclozel added type: task A general task status: noteworthy A noteworthy issue to call out in the release notes labels Sep 21, 2022
@bclozel bclozel added this to the 3.0.0-RC1 milestone Sep 21, 2022
@bclozel bclozel self-assigned this Sep 21, 2022
@wilkinsona wilkinsona added type: enhancement A general enhancement and removed type: task A general task labels Sep 21, 2022
@wilkinsona
Copy link
Member

I've labeled this as an enhancement as I think we'll want it to be listed in the changelog.

bclozel added a commit that referenced this issue Sep 29, 2022
As htttpclient 4.x is not supported anymore by `RestTemplate`, this
commit changes such dependencies to httpclient5 instead. In some cases,
the httpclient 4.x was transitively brought by a non-Spring dependency.

See gh-32461
bclozel added a commit that referenced this issue Sep 29, 2022
This commit adapts the auto-detection of `ClientHttpRequestFactory` to
look for an httpclient5 class.

See gh-32461
bclozel added a commit that referenced this issue Sep 29, 2022
Prior to this commit, the `RestTemplateBuilder` would offer a generic
`setReadTimeout` method to configure the read timeout on the underlying
`ClientHttpRequestFactory`. This would be done in a reflective fashion,
considering that all implementations align with this behavior.

This option cannot be provided for HttpClient5 at the
`ClientHttpRequestFactory` level anymore, so this has been deprecated
in Spring Framework 6.0 and will log a warning. In order to align with
our existing behavior (throwing exceptions if the option cannot be set),
this commit ensures that exceptions are also thrown if the method is
marked as deprecated.

See gh-32461
bclozel added a commit that referenced this issue Sep 29, 2022
This commit adapts the `TestRestTemplate` implementation to the
httpclient5 API since httpclient 4.x is now unsupported in Spring
Framework.

See gh-32461
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: noteworthy A noteworthy issue to call out in the release notes type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants