fdhfgh 发表于 2017-12-14 21:35:07

mongoDB数据库和Spring MVC的整合

<?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:jee="http://www.springframework.org/schema/jee"
  xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:util="http://www.springframework.org/schema/util"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:mongo="http://www.springframework.org/schema/data/mongo"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
  http://www.springframework.org/schema/tx
  http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
  http://www.springframework.org/schema/jee
  http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
  http://www.springframework.org/schema/context
  http://www.springframework.org/schema/context/spring-context-4.1.xsd
  http://www.springframework.org/schema/schema/util
  http://www.springframework.org/schema/schema/util/spring-util-4.1.xsd
  http://www.springframework.org/schema/data/mongo
  http://www.springframework.org/schema/data/mongo/spring-mongo-1.5.xsd
  http://www.springframework.org/schema/data/repository
  http://www.springframework.org/schema/data/repository/spring-repository-1.5.xsd
  ">
  

  <mongo:mongo   replica-set="${mongodb.replicaSet}" />
  <mongo:db-factory dbname="${mongodb.database}" mongo-ref="mongo"/>
  

  <!-- mongo模板操作对象 -->
  <bean>
  <constructor-arg name="mongoDbFactory" ref="mongoDbFactory"/>
  </bean>
  

  
</beans>
页: [1]
查看完整版本: mongoDB数据库和Spring MVC的整合