Fix bugs about token-credential-bean-name property #47470
Merged
Conversation
…n-name not take effect in AzureEventHubsMessagingAutoConfiguration
6 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes two bugs related to the token-credential-bean-name property in Azure Spring Cloud autoconfiguration for Service Bus and Event Hubs.
Purpose: Resolves issues where multiple TokenCredential beans were being injected in Service Bus configuration, and where the spring.cloud.azure.eventhubs.credential.token-credential-bean-name property was not taking effect in Event Hubs configuration.
Key Changes:
- Added
@Qualifier(DEFAULT_TOKEN_CREDENTIAL_BEAN_NAME)annotations toTokenCredentialparameters in Service Bus and Event Hubs autoconfiguration classes to ensure the correct default credential bean is injected - Added
tokenCredentialResolveranddefaultCredentialsetters to Event Hubs factory beans to enable custom token credential configuration - Added comprehensive integration tests to verify the custom token credential configuration works correctly for both services
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| AzureServiceBusMessagingAutoConfiguration.java | Added @Qualifier annotations to three factory bean methods to resolve the multiple TokenCredential beans issue |
| AzureEventHubsMessagingAutoConfiguration.java | Added @Qualifier annotations and set tokenCredentialResolver/defaultCredential on factory beans to enable the token-credential-bean-name property |
| AzureServiceBusMessagingAutoConfigurationTests.java | Added comprehensive test verifying custom token credential configuration and updated lambda expression to use method reference |
| AzureEventHubsMessagingAutoConfigurationTests.java | Added comprehensive test verifying custom token credential configuration and updated lambda expression to use method reference |
.../autoconfigure/implementation/servicebus/AzureServiceBusMessagingAutoConfigurationTests.java
Show resolved
Hide resolved
...ud/autoconfigure/implementation/eventhubs/AzureEventHubsMessagingAutoConfigurationTests.java
Show resolved
Hide resolved
moarychan
approved these changes
Dec 8, 2025
Netyyyy
pushed a commit
to Netyyyy/azure-sdk-for-java
that referenced
this pull request
Dec 9, 2025
(cherry picked from commit 21c680a)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
token-credential-bean-nameproperty #47285TokenCredentialbean found in AzureServiceBusMessagingAutoConfiguration.spring.cloud.azure.eventhubs.credential.token-credential-bean-namenot take effect in AzureEventHubsMessagingAutoConfiguration.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines