@Override
public Mongo mongo() throws Exception {
if(!authenticate) {
//Allows testing with a database without users and authentication configured.
//should not be used in production.
log.warn("MongoDB is accessed without any authentication. " +
"This is strongly discouraged and should only be used in a testing environment.");
return new MongoClient(hostname);
} else {
List<MongoCredential> cred = new LinkedList<>();
cred.add(MongoCredential.createCredential(dbUserName, dbAuthDB, dbPasswd.toCharArray()));
ServerAddress addr = new ServerAddress(hostname, dbPort);
return new MongoClient(addr, cred);
}
}
SpringMongoConfig.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:kanbanboard
作者:
评论列表
文章目录