Share via

Spring Cloud + Cosmos DB in Azure Function

Mathew James 421 Reputation points
2023-06-09T01:41:08.9566667+00:00

Hi everyone - We are trying to use Spring cloud in Azure Functions which connects to Cosmos db.

We are facing issues w.r.t version mismatch (pom.xml) and hence multiple errors and unable to Connect to Cosmos db.

I have read several articles and we are even able to connect Spring cloud with Cosmos, but when its put in Azure function, we are unable to access the same.

Please let me know if one has succeeded in doing this.

Thanks!
-Mathew

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.


1 answer

Sort by: Most helpful
  1. Sedat SALMAN 14,455 Reputation points MVP
    2023-06-13T21:24:28.26+00:00

    https://devblogs.microsoft.com/cosmosdb/building-and-deploying-java-apps-with-spring-cloud-and-azure-cosmos-db/

    There is a guide on deploying Java applications using Spring Cloud and Azure Cosmos DB, according to the reference I found. The guide makes use of the open-source project Spring Cloud Azure, which integrates Spring with Azure services. With minimal code changes and configuration, this project simplifies the connection and consumption of Azure services. This guide requires the following tools and resources: an Azure subscription, Terraform, JDK8 or later, Git, Jq, Docker, and Maven.

    Cloning and building a sample repository, provisioning Azure resources, running a terraform script to create Azure resources, and exporting environment values to your local environment are all part of the process.

    There appears to be a scarcity of comprehensive resources detailing how to integrate Azure Functions with Spring Cloud and Azure Cosmos DB. I did find some resources on running Spring Cloud applications locally and creating Docker images for these applications, but the process of integrating these with Azure Functions was not explicitly covered.

    Given your specific issue of a pom.xml version mismatch, it may be beneficial to ensure that all of your dependencies are compatible with one another. Check that the Spring Cloud, Azure Functions, and Cosmos DB versions you're using are known to work well together. If the problem persists, you should consider contacting a specialized forum or Microsoft's support channels. I might be able to provide more specific advice if you could provide more specific information about the errors you're experiencing.

    Was this answer helpful?

    0 comments No comments

Your answer

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