Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.34k stars 1.98k forks source link

[BUG] azure-spring-boot-starter-keyvault-secrets hangs with spring-boot 2.4.4 #20759

Closed Tcharl closed 3 years ago

Tcharl commented 3 years ago

Describe the bug Using the latest and greatest azure-spring-boot-starter-keyvault-secrets indefinitely hangs on start

Exception or Stack Trace No exception at all, just stucked

To Reproduce Steps to reproduce the behavior:

I generated an app with the latest jhipster, then added these dependencies:

<dependency>
            <groupId>com.azure.spring</groupId>
            <artifactId>azure-spring-boot-starter-keyvault-secrets</artifactId>
            <version>3.3.0</version>
        </dependency>
        <dependency><!-- Mandatory because spring uses databind 2.11.4 which is incompatible with keyvault-->
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.12.1</version>
        </dependency>

Code Snippet

Here's my jdl if you want to try

application {
  config {
    baseName economicintelligence,
    applicationType monolith,
    packageName com.thalesgroup,
    authenticationType oauth2,
    devDatabaseType h2Disk,
    prodDatabaseType mysql,
    clientFramework angular,
    languages [en,fr],
    testFrameworks [cypress],
    enableSwaggerCodegen true
  }
  entities *
}

entity GBU {
  name String required unique
}

entity BL {
  name String required unique pattern(/(A-Za-z0-9)+/)
}

entity Market {
  name String required unique
  globalRevenue Double min(0)
}

entity Country {
  name String required
  flag ImageBlob
}

entity Competitor {
  name String required unique
  joinVenture Boolean
  partner Boolean
  logo ImageBlob
}

entity MarketShare {
  description String required
  percentage Integer min(1) max (100)
    date LocalDate
}

relationship OneToMany {
  GBU{bls(name)} to BL{gbu(name) required}
  Competitor{shares(description)} to MarketShare{competitor(name)}
  BL{shares(description)} to MarketShare{bl(name)}
  Country{shares(description)} to MarketShare{country(name)}
  Market{shares(description)} to MarketShare{market(name) required}
}
relationship ManyToMany {
  Market{competitors(name)} to Competitor{markets(name)}
  Country{competitors(name)} to Competitor{countries(name)}
}

service * with serviceImpl
readOnly GBU
paginate MarketShare with infinite-scroll
paginate Competitor with pagination
filter BL, Country, Competitor

Expected behavior My secrets to be retreived :-)

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

Additional context Add any other context about the problem here.

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

yiliuTo commented 3 years ago

Thanks for your reporting, we will look into it soon.

Tcharl commented 3 years ago

FYI, it's on spring boot 2.4.4

yiliuTo commented 3 years ago

Hi @Tcharl , I reproduced your issue with our sample by specifying spring boot as 2.4.4 and jackson-databind as 2.12.1. And the bug is caused due to that spring boot 2.4.4 only supports jackson 2.11.1 while our starter supports both 2.12.1 and 2.11.1 actually, which could be refered to https://github.com/Azure/azure-sdk-for-java/pull/19967/ and https://github.com/Azure/azure-sdk-for-java/pull/19918. So in our sample, it could work with spring boot 2.4.4 and jackson-databind 2.11.1. So you could try with removing below version in your pom.xml

        <dependency><!-- Mandatory because spring uses databind 2.11.4 which is incompatible with keyvault-->
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.12.1</version>
        </dependency>

If it still hangs after modifying version of jackson-databind, cloud you provide a project with our sample that could reproduce your issue?

Tcharl commented 3 years ago

Not possible: azure vault is using a method that do not exists in 2.11.x...

yiliuTo commented 3 years ago

Hi @Tcharl , I ignored that the mentioned commits to support both 2.12.x and 2.11.x are not in our starter 3.3.0. So I think you could use the key vault starter 3.4.0 and remove dependency of jackson-databind:2.12.1, or use starter 3.3.0 together with the following dependency:

<dependency>
        <groupId>com.azure</groupId>
        <artifactId>azure-core</artifactId>
        <version>1.14.1</version>
      </dependency>
yiliuTo commented 3 years ago

Close this issue for no response for the customer. If you still have any issue, please open it again.