Spring整合MongoDB,封装MongoTemplate常用操作方法
所需Jar包 mongo-java-driver-3.3.0.jar spring-data-mongodb-1.10.15.RELEASE.jar 配置mongodb.properties mongo.hostport=127.0.0.1:27017 mongo.connectionsPerHost=8 mongo.threadsAllowedToBlockForConnectionMultiplier=4 mongo.connectTimeout=3000 mongo.maxWaitTime=1500 mongo.socketKeepAlive=true mongo.socketTimeout=30000 mongo.authDB=admin # 认证的数据库 mongo.username=admin mongo.password=123456 mongo.connectDB=project # 需要操作的数据库 配置mongodb.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http