1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
- default-lazy-init="true">
- <!-- Activates scanning of @Autowired -->
- <context:annotation-config/>
- <!-- Activates scanning of @Repository and @Service -->
- <context:component-scan base-package="com.palmnest"/>
-
- <!-- jedis pool配置 -->
- <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
- <property name="maxTotal" value="1000"/> <!-- 控制一个pool可分配多少个jedis实例 -->
- <property name="maxIdle" value="200" /> <!-- 控制一个pool最多有多少个状态为idle(空闲)的jedis实例 -->
- <property name="maxWaitMillis" value="2000" /> <!-- 表示当borrow一个jedis实例时,最大的等待时间,如果超过等待时间,则直接抛出JedisConnectionException -->
- <property name="testOnBorrow" value="true" /> <!-- 在borrow一个jedis实例时,是否提前进行validate操作;如果为true,则得到的jedis实例均是可用的 -->
- </bean>
-
- <bean id="jedisConnFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" >
- <property name="hostName" value="172.25.220.214" /> <!-- ip -->
- <property name="port" value="6379" /> <!-- 端口 -->
- <property name="password" value="" /><!-- 鉴权密码 -->
- <property name="database" value="1" />
- <property name="poolConfig" ref="jedisPoolConfig"></property>
- </bean>
-
- <!-- redis template definition -->
- <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate" >
- <property name="connectionFactory" ref="jedisConnFactory" />
- </bean>
- <!-- Add new DAOs here -->
- <!-- spring-data for mongo-db configuration -->
- <!-- factory bean that creates the Mongo instance -->
- <bean id="mongo" class="org.springframework.data.mongodb.core.MongoFactoryBean">
- <property name="host" value="localhost"/>
- <property name="port" value="27017"/>
- </bean>
- <bean id="userCredentials" class="org.springframework.data.authentication.UserCredentials">
- <constructor-arg name="username" value="avicmongo" />
- <constructor-arg name="password" value="avic.palmnest" />
- </bean>
- <!-- Define the MongoTemplate which handles connectivity with MongoDB -->
- <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
- <constructor-arg name="mongo" ref="mongo"/>
- <constructor-arg name="databaseName" value="avic"/>
- <constructor-arg name="userCredentials" ref="userCredentials" />
- </bean>
- </beans>
|