generated from root/miduo_server
print log
parent
6a1b0282e3
commit
35f096eece
|
|
@ -1,6 +1,9 @@
|
|||
package com.ljsd.util;
|
||||
|
||||
import com.ljsd.controller.GetUserController;
|
||||
import com.mongodb.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -10,6 +13,7 @@ import java.util.Properties;
|
|||
* mongodb数据库链接池
|
||||
*/
|
||||
public class MyMongoDBPool {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MyMongoDBPool.class);
|
||||
private MongoClient mongoClient = null;
|
||||
private String dbName;
|
||||
private DB db;
|
||||
|
|
@ -29,6 +33,7 @@ public class MyMongoDBPool {
|
|||
mongoClient = new MongoClient(mongodb_host);
|
||||
dbName = properties.getProperty("mongodb_name");
|
||||
db = mongoClient.getDB(dbName);
|
||||
LOGGER.info("the dbName={},mongoUrl={}",dbName,properties.getProperty("mongodb_url"));
|
||||
}
|
||||
|
||||
public DBCollection getCollection(String collectionName) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue