mongodb的密码有@,springboot的uri怎么写?
解决方法:
mongodb的密码有@连接报错:
Caused by: java.lang.IllegalArgumentException: The connection string contains invalid user information. If the username or password contains a colon (:) or an at-sign (@) then it must be urlencoded
错误写法:
spring:
data:
mongodb:uri: "mongodb://admin:admin@wang@134.175.154.136:27017/survet2"
正确写法,把密码中的@改为%40:
spring:
data:
mongodb:
uri: "mongodb://admin:admin%40wang@134.175.154.136:27017/survet2"