How to connect to 2 different cosmos Databases in Java?

40 views Asked by At

I am trying to connect to 2 cosmos databases in Java springboot application. If I define azure.cosmos.database ="somevalue"

It always picks the above value though in AppConfig I am using a different databases to create a bean.

if I remove the azure.cosmos.database from application.yml, It give the following error: Description:

Binding to target org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'azure.cosmos' to com.azure.spring.autoconfigure.cosmos.CosmosProperties failed:

Property: azure.cosmos.uri
Value: null
Reason: must not be empty

Property: azure.cosmos.database
Value: null
Reason: must not be empty

Property: azure.cosmos.key
Value: null
Reason: must not be empty

Any suggestion or inputs are appreciated.

0

There are 0 answers