Skip to content

Fix Redis Lettuce passwordless auto-config bean collision#49293

Merged
rujche merged 4 commits into
mainfrom
copilot/bug-fix-lack-bean-name-conditionalonmissingbean
May 28, 2026
Merged

Fix Redis Lettuce passwordless auto-config bean collision#49293
rujche merged 4 commits into
mainfrom
copilot/bug-fix-lack-bean-name-conditionalonmissingbean

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

Redis passwordless auto-configuration was gating the Azure LettuceClientConfigurationBuilderCustomizer by type, so any user-defined customizer could suppress the Azure one entirely. That dropped the Azure Redis credentials provider and RESP2 configuration, breaking passwordless auth in a way that was hard to diagnose.

  • Auto-configuration

    • Narrow the missing-bean condition from type-based to name-based for azureLettuceClientConfigurationBuilderCustomizer.
    • Preserve the Azure Lettuce customizer even when applications register their own LettuceClientConfigurationBuilderCustomizer for unrelated concerns.
  • Regression coverage

    • Add a unit test that registers a user customizer and verifies both customizers coexist in the application context.
  • Documentation

    • Add a Spring changelog entry describing the Redis Lettuce passwordless auto-configuration fix.

Example of the behavioral change:

@Bean(name = "azureLettuceClientConfigurationBuilderCustomizer")
@ConditionalOnMissingBean(name = "azureLettuceClientConfigurationBuilderCustomizer")
LettuceClientConfigurationBuilderCustomizer azureLettuceClientConfigurationBuilderCustomizer(
    AzureRedisCredentials azureRedisCredentials) {
    // configures Azure Redis credentials provider + RESP2
}

With this change, a user bean such as:

@Bean
LettuceClientConfigurationBuilderCustomizer userCustomizer() {
    return builder -> { /* pool / timeout tuning */ };
}

no longer suppresses the Azure passwordless customizer.

@rujche rujche added bug This issue requires a change to an existing behavior in the product in order to be resolved. azure-spring All azure-spring related issues labels May 28, 2026
@rujche rujche moved this from Todo to In Progress in Spring Cloud Azure May 28, 2026
@rujche rujche added this to the 2026-06 milestone May 28, 2026
Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix lack of bean name in @ConditionalOnMissingBean Fix Redis Lettuce passwordless auto-config bean collision May 28, 2026
Copilot finished work on behalf of rujche May 28, 2026 05:54
Copilot AI requested a review from rujche May 28, 2026 05:54
@rujche rujche marked this pull request as ready for review May 28, 2026 05:59
Copilot AI review requested due to automatic review settings May 28, 2026 05:59
@rujche rujche requested review from a team, Netyyyy, moarychan and saragluna as code owners May 28, 2026 05:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Redis Lettuce passwordless Spring auto-configuration so the Azure Lettuce customizer is not skipped when applications define their own LettuceClientConfigurationBuilderCustomizer.

Changes:

  • Changes the Azure Lettuce customizer condition from type-based to bean-name-based.
  • Adds regression coverage verifying user and Azure Lettuce customizers coexist.
  • Adds a changelog entry for the Redis passwordless auto-configuration fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/data/redis/AzureLettucePasswordlessAutoConfiguration.java Narrows the missing-bean condition to the Azure customizer bean name.
sdk/spring/spring-cloud-azure-autoconfigure/src/test/java/com/azure/spring/cloud/autoconfigure/implementation/data/redis/AzureLettucePasswordlessAutoConfigurationTest.java Adds a regression test for coexistence with a user-defined Lettuce customizer.
sdk/spring/CHANGELOG.md Documents the Redis Lettuce passwordless auto-configuration bug fix.

@rujche
Copy link
Copy Markdown
Member

rujche commented May 28, 2026

/azp run java - spring - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Comment thread sdk/spring/CHANGELOG.md
Co-authored-by: rujche <171773178+rujche@users.noreply.github.com>
Copilot finished work on behalf of rujche May 28, 2026 06:23
Copilot AI requested a review from rujche May 28, 2026 06:23
@rujche
Copy link
Copy Markdown
Member

rujche commented May 28, 2026

/azp run java - spring - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread sdk/spring/CHANGELOG.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@rujche
Copy link
Copy Markdown
Member

rujche commented May 28, 2026

/azp run java - spring - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Member

@Netyyyy Netyyyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@rujche rujche merged commit 3e24920 into main May 28, 2026
84 checks passed
@rujche rujche deleted the copilot/bug-fix-lack-bean-name-conditionalonmissingbean branch May 28, 2026 08:30
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Spring Cloud Azure May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure-spring All azure-spring related issues bug This issue requires a change to an existing behavior in the product in order to be resolved.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug] Lack bean name in @ConditionalOnMissingBean for LettuceClientConfigurationBuilderCustomizer

4 participants