Spring Boot app does not start/hangs when kusto-data dependency is added to a project containing spring-cloud-azure-starter-keyvault dependency

MarkL 5 Reputation points
2023-07-21T04:40:01.37+00:00

I have a working Spring Boot version 3.1.1 web application using "kusto-data" version 5.0.0 to query ADX data.

If I add "spring-cloud-azure-starter-keyvault" version 5.3.0 as a dependency to the project pom and place the "spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=[myVaultUrl]" in the application.properties file, then the Spring Boot application will not start.

If I work from the other creating a simple 3.1.1 Spring Boot Application with just "spring-boot-starter-web" and "spring-cloud-azure-starter-keyvault" version 5.3.0 and add the above application.properties keyvault endpoint with a @Value variable, then the secret value is populated correctly. As soon as I add "kusto-data" version 5.0.0, then the Spring Boot application will not start.

pom.xml



application.properties

spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://[myvaultname].vault.azure.net/
somepassword=${some-app-password}

Java Application file

@SpringBootApplication
public class KvtestApplication implements CommandLineRunner {   

   @Value("${somepassword}")
   private String password;

   public static void main(String[] args) {
      SpringApplication.run(KvtestApplication.class, args);
   }
  
   @Override   public void run(String... args) throws Exception {           
      System.out.println(password);   
   }
}

Thanks

Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
124 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 16,346 Reputation points Microsoft Employee
    2023-08-02T21:58:17.25+00:00

    @MarkL It seems that there is a conflict between the "kusto-data" version 5.0.0 and "spring-cloud-azure-starter-keyvault" version 5.3.0 dependencies. When you add both dependencies to your project, the Spring Boot application hangs and does not start.

    One possible solution is to exclude the conflicting dependencies from the "spring-cloud-azure-starter-keyvault" dependency. You can do this by adding the following exclusion to the "spring-cloud-azure-starter-keyvault" dependency in your pom.xml file:

    <dependency>
       <groupId>com.azure.spring</groupId>
       <<span class=" active-doc-0 active-doc-1 active-doc-2" data-doc-items="0,1,2">artifactId>spring-cloud-azure-starter-keyvault</artifactId[1](#doc-pos=0)[2](#doc-pos=1)[3](#doc-pos=2)</span>>
       <exclusions>
          <exclusion>
             <groupId>com.azure</groupId>
             <artifactId>azure-core</artifactId>
          </exclusion>
          <exclusion>
             <groupId>com.azure</groupId>
             <artifactId>azure-identity</artifactId>
          </exclusion>
       </exclusions>
    </dependency>
    

    This will exclude the "azure-core" and "azure-identity" dependencies from the "spring-cloud-azure-starter-keyvault" dependency. You can then add these dependencies separately to your project with the correct versions that are compatible with "kusto-data" version 5.0.0.

    Another possible solution is to upgrade the "kusto-data" dependency to a version that is compatible with "spring-cloud-azure-starter-keyvault" version 5.3.0. You can check the compatibility matrix of the dependencies to find the compatible versions. The compatibility matrix is a table that shows the compatible versions of different dependencies. In this case, you need to find the compatible versions of "kusto-data" and "spring-cloud-azure-starter-keyvault" dependencies.

    You can find the compatibility matrix for Azure SDKs and libraries on the following page: https://docs.microsoft.com/en-us/azure/developer/java/azure-sdk-compatibility-matrix

    To find the compatible versions of "kusto-data" and "spring-cloud-azure-starter-keyvault" dependencies, you can look at the "Azure SDK for Java" section of the compatibility matrix. In this section, you can find the compatible versions of different Azure SDKs and libraries.

    For example, if you look at the "Azure SDK for Java" section of the compatibility matrix, you can see that "kusto-data" version 5.0.0 is compatible with "azure-identity" version 1.2.5 and "azure-core" version 1.16.0. You can also see that "spring-cloud-azure-starter-keyvault" version 5.3.0 is compatible with "azure-identity" version 1.2.5 and "azure-core" version 1.16.0.

    This means that you can use "kusto-data" version 5.0.0 and "spring-cloud-azure-starter-keyvault" version 5.3.0 together if you also use "azure-identity" version 1.2.5 and "azure-core" version 1.16.0.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.