microsoft / spring-cloud-azure

Spring Cloud Azure is an open-source project that provides seamless Spring integration with Azure services.
https://microsoft.github.io/spring-cloud-azure
MIT License
217 stars 105 forks source link

[BUG] spring-cloud-sleuth breaks BlobContainerClient initialization #1042

Closed rvervaek closed 1 year ago

rvervaek commented 1 year ago

Describe the bug When declaring BlobContainerClient as a Spring bean (using the createBlobContainerIfNotExists method) the startup of the Spring Boot application context hangs forever when spring-cloud-starter-sleuth is on the classpath.

Exception or Stack Trace

2022-12-02 11:52:27.586  INFO [,,] 26596 --- [           main] AbstractAzureServiceClientBuilderFactory : Will configure the default credential of type DefaultAzureCredential for class com.azure.identity.DefaultAzureCredentialBuilder.
2022-12-02 11:52:27.636  INFO [,,] 26596 --- [           main] AbstractAzureServiceClientBuilderFactory : Will configure the default credential of type DefaultAzureCredential for class com.azure.storage.blob.BlobServiceClientBuilder.
2022-12-02 11:52:28.003  INFO [,,] 26596 --- [     parallel-1] c.azure.identity.ChainedTokenCredential  : Azure Identity => Attempted credential EnvironmentCredential is unavailable.
2022-12-02 11:52:28.035  INFO [,,] 26596 --- [     parallel-1] c.azure.identity.ChainedTokenCredential  : Azure Identity => Attempted credential ManagedIdentityCredential is unavailable.
2022-12-02 11:52:28.137  INFO [,,] 26596 --- [  az-identity-1] c.azure.identity.ChainedTokenCredential  : Azure Identity => Attempted credential SharedTokenCacheCredential is unavailable.
2022-12-02 11:52:28.238 ERROR [,,] 26596 --- [  az-identity-1] c.a.i.i.WindowsCredentialAccessor        : Element not found.
2022-12-02 11:52:28.239  INFO [,,] 26596 --- [  az-identity-1] c.azure.identity.ChainedTokenCredential  : Azure Identity => Attempted credential IntelliJCredential is unavailable.
2022-12-02 11:52:28.241 ERROR [,,] 26596 --- [  az-identity-1] c.a.i.i.WindowsCredentialAccessor        : Element not found.
2022-12-02 11:52:28.242  INFO [,,] 26596 --- [  az-identity-1] c.azure.identity.ChainedTokenCredential  : Azure Identity => Attempted credential VisualStudioCodeCredential is unavailable.
2022-12-02 11:52:30.192  INFO [,,] 26596 --- [  az-identity-1] com.azure.identity.AzureCliCredential    : Azure Identity => getToken() result for scopes [https://storage.azure.com/.default]: SUCCESS
2022-12-02 11:52:30.192  INFO [,,] 26596 --- [  az-identity-1] c.azure.identity.ChainedTokenCredential  : Azure Identity => Attempted credential AzureCliCredential returns a token
2022-12-02 11:52:30.192  INFO [,,] 26596 --- [  az-identity-1] c.a.c.implementation.AccessTokenCache    : Acquired a new access token.

To Reproduce Reproducable example in attachment

Code Snippet

    @Bean
    public BlobContainerClient blobContainerClient(BlobServiceClient blobServiceClient) {
        return blobServiceClient.createBlobContainerIfNotExists("test");
    }

Expected behavior Either the Spring Boot Application starts successfully or fails with an error.

Additional context

bug.zip

chenrujun commented 1 year ago

Hi, @backwind1233 , please help to handle this issue.

backwind1233 commented 1 year ago

Hi @rvervaek thanks for reaching out, our repo has be migrated to azure-sdk-for-java, so I copied current issue to that repo, let's use that issue to track.

backwind1233 commented 1 year ago

Closing this, redirect to https://github.com/Azure/azure-sdk-for-java/issues/32424.