[BUG] springTokenCredentialProviderContextProvider bean is missing from the context #43147
Labels
azure-spring
All azure-spring related issues
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
springTokenCredentialProviderContextProvider
bean is missing from the context. When beanspringCloudAzureGlobalProperties
is registred, the conditiondependsOn
cannot be met. The code below:Exception or Stack Trace
To Reproduce
Create a spring boot app, with eventhub binding and postgres passwordless connection (check application.properties configs)
If you run in debug mode, you'll see that the
springTokenCredentialProviderContextProvider
bean is configured in overall ApplicationContext, when the JDBC context is risen.As
EventHubsBinderConfiguration
depends onAzureGlobalPropertiesAutoConfiguration
, when registering thespringCloudAzureGlobalProperties
bean, the dependsOn condition will also run in this case.When eventhub binder creates another ApplicationContext, the above context is not set as parent. Therefore, the
springTokenCredentialProviderContextProvider
bean is not available in that tiny context.Check for: DefaultBinderFactory.initializeBinderContextSimple() -> useApplicationContextAsParent var
There're two separate application contexts and the
springTokenCredentialProviderContextProvider
bean is missing from the binder application context, thus the overall app cannot bootstrap.Code Snippet
application.properties config:
EH consumption method:
Expected behavior
Application context can bootstrap as usual.
Setup (please complete the following information):
The text was updated successfully, but these errors were encountered: