ringboot中使用mondodb连接池,用户名和密码都对就是认证不过,客户端可以成功连接,为什么
解决方法:
错误信息:
Caused by: com.mongodb.MongoCommandException: Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "Authentication failed.", "code": 18, "codeName": "AuthenticationFailed"}
看错误知道是登陆失败,用户认证不通过,但我使用客户端连接是可以的,到了java代码连接就不行,后来调试了一下,发现MongoProperties 注入的password是空字符串,因为:http://www.yayihouse.com/yayishuwu/chapter/2182