Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password

错误如下:

Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password=<hidden>, mechanismProperties={}}; nested exception is com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password=<hidden>, mechanismProperties={}}"}

原因和解决方法:

因为在properties中配置了两句:

spring.data.mongodb.username=
spring.data.mongodb.password=

导致需要用户名和密码,username就是'',password就是hidden MongoDB如果没有特殊配置不要写下面两条语句

解决方法:去掉这两句就行了

猜你喜欢

转载自blog.csdn.net/qq_34419607/article/details/102485041