Skip to content

Initialize refresh token response client lazily#19452

Open
xfocus3 wants to merge 1 commit into
spring-projects:mainfrom
xfocus3:gh-19406-lazy-refresh-client
Open

Initialize refresh token response client lazily#19452
xfocus3 wants to merge 1 commit into
spring-projects:mainfrom
xfocus3:gh-19406-lazy-refresh-client

Conversation

@xfocus3

@xfocus3 xfocus3 commented Jul 16, 2026

Copy link
Copy Markdown

Fixes gh-19406

The default RestClientRefreshTokenTokenResponseClient is now created only when a refresh-token request is actually needed. This keeps RefreshTokenOAuth2AuthorizedClientProvider cheap to instantiate for applications where no refresh is attempted during startup.

A regression test verifies that an authorization attempt with a non-expired access token returns without initializing the default response client.

Tests:

  • ./gradlew :spring-security-oauth2-client:test --tests 'org.springframework.security.oauth2.client.RefreshTokenOAuth2AuthorizedClientProviderTests' --no-daemon --console=plain
  • ./gradlew :spring-security-oauth2-client:check --no-daemon --console=plain

Signed-off-by: Ahmed <amraouiyine@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RefreshTokenOAuth2AuthorizedClientProvider initialization slows down application startup

2 participants