spring-push-redis.xml
1.72 KB
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- pool config -->
<bean id="pushJedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="${redis.pool.maxTotal:50}" />
<property name="maxIdle" value="${redis.pool.maxIdle:20}" />
<property name="minIdle" value="${redis.pool.minIdle:20}"/>
<property name="maxWaitMillis" value="${redis.pool.maxWaitMillis:2000}" />
<property name="testOnBorrow" value="${redis.pool.testOnBorrow:false}" />
<property name="testWhileIdle" value="${redis.pool.testWhileIdle:false}"/>
</bean>
<bean id="pushRedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<property name="poolConfig" ref="pushJedisPoolConfig" />
<property name="port" value="${redis.push.port}" />
<property name="hostName" value="${redis.push.address}" />
<property name="password" value="${redis.push.auth}"/>
<property name="timeout" value="1000"></property>
</bean>
<bean id="pushRedisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
<property name="connectionFactory" ref="pushRedisConnectionFactory" />
<property name="keySerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
</property>
<property name="valueSerializer">
<bean class="org.springframework.data.redis.serializer.StringRedisSerializer" />
</property>
</bean>
</beans>