Query/Question
In AzureLettucePasswordlessAutoConfiguration, the azureLettuceClientConfigurationBuilderCustomizer
bean is annotated with @ConditionalOnMissingBean:
https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/data/redis/AzureLettucePasswordlessAutoConfiguration.java#L61-L76
Since @ConditionalOnMissingBean without an explicit value or type attribute resolves to the
return type of the method (LettuceClientConfigurationBuilderCustomizer), this bean is skipped
entirely if any other bean of the same type already exists in the application context — even if
that bean serves a completely different purpose.
As a result, when a user defines their own LettuceClientConfigurationBuilderCustomizer (e.g., for
connection pool tuning), the following Azure-specific configurations are silently lost:
redisCredentialsProviderFactory(...) — required for passwordless (Azure AD token-based) authentication
clientOptions(...protocolVersion(ProtocolVersion.RESP2)...) — required for RESP2 protocol compatibility
This effectively disables passwordless authentication without any warning or error, which can be
extremely difficult to diagnose.
- If intentional: Could you please document that users must incorporate
redisCredentialsProviderFactory
and ProtocolVersion.RESP2 into their own customizer when they define one?
- If unintentional: Would it make sense to either remove
@ConditionalOnMissingBean entirely,
or narrow the condition to @ConditionalOnMissingBean(name = "azureLettuceClientConfigurationBuilderCustomizer")
so that it guards only by bean name rather than by type?
Note: LettuceClientConfigurationBuilderCustomizer is designed by Spring Boot / Spring Data Redis to
support multiple instances coexisting in the same application context. The bean name
azureLettuceClientConfigurationBuilderCustomizer is explicitly set via @Bean(name = "..."),
yet the condition is evaluated by type — making the explicit name effectively meaningless for the
purpose of this guard.
Why is this not a Bug or a Feature Request?
This is raised as a question because the behavior may be intentional — the @ConditionalOnMissingBean
could be a deliberate design choice to allow users to fully take over the Lettuce client configuration.
However, if unintentional, it would qualify as a bug. Clarification from the maintainers is needed
before filing it as a bug report.
Setup (please complete the following information if applicable):
- OS: (please fill in)
- IDE: (please fill in)
- Library/Libraries:
com.azure.spring:spring-cloud-azure-autoconfigure (please fill in version)
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required
fields otherwise we will treat the issuer as an incomplete report
Note: English is not my first language. This was translated with AI assistance — apologies for any awkward phrasing.
Query/Question
In
AzureLettucePasswordlessAutoConfiguration, theazureLettuceClientConfigurationBuilderCustomizerbean is annotated with
@ConditionalOnMissingBean:https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/spring-cloud-azure-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/implementation/data/redis/AzureLettucePasswordlessAutoConfiguration.java#L61-L76
Since
@ConditionalOnMissingBeanwithout an explicitvalueortypeattribute resolves to thereturn type of the method (
LettuceClientConfigurationBuilderCustomizer), this bean is skippedentirely if any other bean of the same type already exists in the application context — even if
that bean serves a completely different purpose.
As a result, when a user defines their own
LettuceClientConfigurationBuilderCustomizer(e.g., forconnection pool tuning), the following Azure-specific configurations are silently lost:
redisCredentialsProviderFactory(...)— required for passwordless (Azure AD token-based) authenticationclientOptions(...protocolVersion(ProtocolVersion.RESP2)...)— required for RESP2 protocol compatibilityThis effectively disables passwordless authentication without any warning or error, which can be
extremely difficult to diagnose.
redisCredentialsProviderFactoryand
ProtocolVersion.RESP2into their own customizer when they define one?@ConditionalOnMissingBeanentirely,or narrow the condition to
@ConditionalOnMissingBean(name = "azureLettuceClientConfigurationBuilderCustomizer")so that it guards only by bean name rather than by type?
Note:
LettuceClientConfigurationBuilderCustomizeris designed by Spring Boot / Spring Data Redis tosupport multiple instances coexisting in the same application context. The bean name
azureLettuceClientConfigurationBuilderCustomizeris explicitly set via@Bean(name = "..."),yet the condition is evaluated by type — making the explicit name effectively meaningless for the
purpose of this guard.
Why is this not a Bug or a Feature Request?
This is raised as a question because the behavior may be intentional — the
@ConditionalOnMissingBeancould be a deliberate design choice to allow users to fully take over the Lettuce client configuration.
However, if unintentional, it would qualify as a bug. Clarification from the maintainers is needed
before filing it as a bug report.
Setup (please complete the following information if applicable):
com.azure.spring:spring-cloud-azure-autoconfigure(please fill in version)Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required
fields otherwise we will treat the issuer as an incomplete report
Note: English is not my first language. This was translated with AI assistance — apologies for any awkward phrasing.