Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This sample project demonstrates how to use Azure CosmosDB via Spring Boot Starter azure-cosmosdb-spring-boot-starter to store data in and retrieve data from your Azure Cosmos DB.


Quick Start

Create an Azure Cosmos DB on Azure

  1. Go to Azure portal and click +New .
  2. Click Databases, and then click Azure Cosmos DB to create your database.
  3. Navigate to the database you have created, and click Access keys and copy your URI and access keys for your database.

Config the sample

  1. Navigate to src/main/resources and open
  2. replace below properties in with information of your database.

Run the sample

  1. Change directory to folder azure-cosmosdb-spring-boot-sample.

  2. Run below commands.

    • Use Maven

      mvn package
      java -jar target/azure-ducumentdb-spring-boot-sample-0.0.1-SNAPSHOT.jar
    • Use Gradle

      gradle bootRepackage
      java -jar build/libs/azure-ducumentdb-spring-boot-sample-0.0.1-SNAPSHOT.jar

Known issue

Directly running the sample app from IDE IntelliJ or Eclipse has below security exception if using the released starter. The root cause is that the release spring-data-azure-cosmosdb jar is code-signed by us. We're working actively to resolve this issue.

Caused by: java.lang.SecurityException: class ""'s signer information does not match signer information of other classes in the same package
	at java.lang.ClassLoader.checkCerts( ~[na:1.8.0_131]
	at java.lang.ClassLoader.preDefineClass( ~[na:1.8.0_131]
	at java.lang.ClassLoader.defineClass( ~[na:1.8.0_131]

If com.fasterxml.jackson.databind.JsonMappingException is thrown during deserialization, with error message Can not construct instance of {your.pojo.class}: no suitable constructor found, can not deserialize from Object value (missing default constructor..., add Lombok annotatations @Data and @AllArgsConstructor for your POJO class, or use Jackson annotations @JsonCreator and @JsonProperty for the full argument constructor.

More details

Please refer to this article for the tutorial about how to use the Spring Boot Starter with Azure Cosmos DB API.

You can’t perform that action at this time.