I'm trying to use Azure Cosmos DB instead of MongoDB with my Spring boot app.
Currently, I'm using the mongo.host/database/port
properties. I couldn't find where I can set the SSL option and replicaSet or alternatively the full client URI.
This is the code they suggesting and it's working, but it's not helping me...
MongoClient mongoClient = new MongoClient(
new MongoClientURI("mongodb://[user]:[pass]@[host]:[port]/?ssl=true&replicaSet=globaldb"));
Can you try just using the "spring.data.mongodb.uri" property instead of specifying the host/database/port separately?
The official documentation (https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-connecting-to-mongodb) also recommends this approach while connecting to replica-sets.
This issue is also discussed at How to configure spring-data-mongodb to use a replica set via properties