好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

SpringBoot 整合 Mongodb 配置的坑

这里有一个大坑

如果配置的东西少了  authentication-database: admin   就会出现

org.springframework.data.mongodb.UncategorizedMongoDbException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName=‘user40784318‘, source=‘test‘, password=<hidden>, mechanismProperties=<hidden>}; nested exception is com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName=‘user40784318‘, source=‘test‘, password=<hidden>, mechanismProperties=<hidden>}

异常错误。

 上面的admin 是默认设置的库  我在阿里云上买了一个实例 然后就尝试用SpringBoot 的MongoTemplate连接 结果各种报错 最后排查出问题是少了 

 authentication-database: admin 

这个配置的作用是身份验证

SpringBoot 整合 Mongodb 配置的坑

标签:com   ring   framework   结果   host   rgba   问题   有一个   实例   

查看更多关于SpringBoot 整合 Mongodb 配置的坑的详细内容...

  阅读:29次