spring-redis.xml 1.83 KB
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"
	default-autowire="byName">

	<!-- <bean id="jedisConnFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" 
		p:use-pool="true" p:host-name="192.168.1.145" p:port="6379" /> <bean id="redisTemplate" 
		class="org.springframework.data.redis.core.RedisTemplate" p:connection-factory-ref="jedisConnFactory" 
		/> -->
		<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
		<!-- <property name="maxActive" value="30"/>  -->
		<property name="maxIdle" value="50" />
		<!-- <property name="maxWait" value="100" /> -->
		<property name="testOnBorrow" value="true" />
	</bean>

	<bean id="jedis.shardInfo1" class="redis.clients.jedis.JedisShardInfo">
		<constructor-arg index="0" value="${project.redis.host1}" />
		<constructor-arg index="1" value="${project.redis.port1}" />
	</bean>

	<bean id="shardedJedisPool" class="redis.clients.jedis.ShardedJedisPool">
		<constructor-arg index="0" ref="jedisPoolConfig" />
		<constructor-arg index="1">
			<list>
				<ref bean="jedis.shardInfo1" />
			</list>
		</constructor-arg>
	</bean>

	<bean id="redisUtils" class="com.diligrp.website.util.redis.impl.RedisUtilImpl">
		<property name="shardedJedisPool" ref="shardedJedisPool" />
		<property name="keyRule" value="DILIGRP_USER_" />
	</bean>
</beans>