spring + mongodb 整合 Nosql mongodb 数据库配置文件

来源:互联网 发布:网眼软件官方下载 编辑:程序博客网 时间:2024/05/15 08:24

下图是Spring整合mongodb Nosql数据库的配置文件,具体配置楼主也不是很清楚,希望大神给与指点:

<?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://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans.xsd  http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context.xsd  http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">    <bean id="mongoOptions" class="org.springframework.data.mongodb.core.MongoClientOptionsFactoryBean">    <property name="connectionsPerHost" value="8"></property>    <property name="threadsAllowedToBlockForConnectionMultiplier" value="4"></property>    <property name="connectTimeout" value="1000"></property>    <property name="maxWaitTime" value="1500"></property>    <property name="socketKeepAlive" value="true"></property>    <property name="socketTimeout" value="1500"></property>    </bean>    <bean id="mongo" class="org.springframework.data.mongodb.core.MongoClientFactoryBean">    <property name="mongoClientOptions" ref="mongoOptions"></property>    <property name="host" value="${mongodb.host}"></property>    <property name="port" value="${mongodb.port}"></property>    </bean>        <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">        <constructor-arg ref="mongo" />        <constructor-arg name="databaseName" value="${mongodb.dbName}" />    </bean>    </beans>
不忘初心,方得始终!


0 0