在springboot项目中配置mangodb过程中,发现明明是对的配置,用其他工具可以连接成功,但是springboot就是一直认证失败
spring:
data:
mongodb:
host: localhost
port: 27017
username: cj
password: 123456
database: aaa
authentication-database: admin
最后给用户名和密码加上双引号,成功了
spring:
data:
mongodb:
host: localhost
port: 27017
username: "cj"
password: "123456"
database: aaa
authentication-database: admin