Skip to content

Add recipe for deprecated HttpComponentsClientHttpRequestFactory.setConnectTimeout#919

Merged
timtebeek merged 3 commits intomainfrom
jkschneider/httpcomponents-connect-timeout
Jan 29, 2026
Merged

Add recipe for deprecated HttpComponentsClientHttpRequestFactory.setConnectTimeout#919
timtebeek merged 3 commits intomainfrom
jkschneider/httpcomponents-connect-timeout

Conversation

@jkschneider
Copy link
Member

@jkschneider jkschneider commented Jan 27, 2026

Summary

  • Adds new recipe HttpComponentsClientHttpRequestFactoryConnectTimeout to handle deprecated setConnectTimeout method
  • The method was deprecated in Spring Framework 6.2 and removed in 7.0 due to Spring's use of deprecated Apache HttpClient5 APIs
  • When SSL and connection reuse are involved, using setConnectTimeout on the factory caused the connect timeout to incorrectly become the read timeout on reused connections
  • Recipe adds a TODO comment directing users to configure the connect timeout on the HttpClient builder directly

Test plan

  • Added unit tests for the new recipe

  • Verified recipe adds comment without duplicating on subsequent runs

  • Verified existing HttpComponentsClientHttpRequestFactoryReadTimeout tests still pass

  • Fixes: moderneinc/customer-requests#1751

…onnectTimeout

The setConnectTimeout method was deprecated in Spring Framework 6.2 and removed
in 7.0 because Spring was using deprecated Apache HttpClient5 APIs. This caused
issues where the connect timeout would incorrectly become the read timeout when
using SSL with connection reuse.

The recipe adds a comment directing users to configure the connect timeout
on ConnectionConfig on the PoolingHttpClientConnectionManager.

Fixes: moderneinc/customer-requests#1751
@jkschneider jkschneider force-pushed the jkschneider/httpcomponents-connect-timeout branch from f3600d9 to d6109ba Compare January 27, 2026 21:11
@timtebeek timtebeek merged commit d31b2c5 into main Jan 29, 2026
2 checks passed
@timtebeek timtebeek deleted the jkschneider/httpcomponents-connect-timeout branch January 29, 2026 00:49
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants