[英]Spring with mongo-java-driver Use Azure Cosmos DB as MongoDB
我正在嘗試在我的Spring啟動應用程序中使用Azure Cosmos DB而不是MongoDB 。
當前,我正在使用mongo.host/database/port
屬性。 我找不到在哪里可以設置SSL選項和copysetSet或完整的客戶端URI的位置 。
這是他們建議的代碼,並且有效,但是對我沒有幫助...
MongoClient mongoClient = new MongoClient(
new MongoClientURI("mongodb://[user]:[pass]@[host]:[port]/?ssl=true&replicaSet=globaldb"));
您可以嘗試僅使用“ spring.data.mongodb.uri”屬性,而不是分別指定主機/數據庫/端口嗎?
官方文檔( https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-connecting-to-mongodb )在連接副本集時也建議使用此方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.