Skip to content

Latest commit

 

History

History
 
 

cosmos-multi-database-single-account

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
page_type languages products description urlFragment
sample
java
azure-cosmos-db
Azure Spring Boot Sample project for Cosmos Multi Database Single Account
azure-spring-boot-sample-cosmos-multi-database-single-account

Azure Spring Boot Sample Cosmos Multi Database Single Account for Java

Key concepts

Getting started

Configure Cosmos Database

  1. Log into https://portal.azure.com.

  2. Click Create a resource.

  3. Input Azure Cosmos DB.

  4. Click Azure Cosmos DB Find Cosmos Resource 01

    Find Cosmos Resource 02

  5. Click Create.

    Create new Cosmos

  6. On the Create key vault page, input Subscription, Resource group, Account Name, then click Review + Create.

    Specify the options

    Create Cosmos resource

  7. When complete, click Go to resource.

    Go to resource

  8. Click Keys in the left navigation pane, copy your URI, the PRIMARY KEY and SECONDARY KEY;

    Get Connect Info

Key concepts

Examples

Configure application.yml

azure.cosmos.uri=your-cosmosDb-uri
azure.cosmos.key=your-cosmosDb-key
azure.cosmos.secondary-key=your-cosmosDb-secondary-key
azure.cosmos.database=your-cosmosDb-dbName
azure.cosmos.populate-query-metrics=if-populate-query-metrics

Run with Maven

cd azure-spring-boot-samples/azure-spring-boot-sample-multi-database
mvn spring-boot:run

Verify Result: The corresponding data is added to cosmos database Result in Cosmos Database1 Result in Cosmos Database2

Troubleshooting

Next steps

Contributing