<?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:tx= "Http://www.springframework.org/schema/tx" xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"
Xsi:schemalocation= "
Http://www.springframework.org/schema/aop
Http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
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-3.0.xsd ">
<bean id= "Jedispoolconfig" class= "Redis.clients.jedis.JedisPoolConfig" >
<property name= "Maxtotal" value= "three"/> <!--control how many Jedis instances a pool can allocate
<property name= "Maxidle" value= "three"/> <!--control the maximum number of Jedis instances in a pool that have an idle (idle) status--
<property name= "Maxwaitmillis" value= "$"/> <!--represents the maximum wait time when borrow a Jedis instance, if the wait time is exceeded, is thrown directly jedisconnectionexception--
<property name= "Testonborrow" value= "true"/>
<property name= "Testonreturn" value= "true"/>
</bean>
<!--Redis connection pool pools, not required: Timeout/password--
<bean id= "Jedisconnectionfactory"
class= "Org.springframework.data.redis.connection.jedis.JedisConnectionFactory" >
<property name= "HostName" value= "${redis.host}"/>
<property name= "Port" value= "${redis.port}"/>
<property name= "Password" value= "${redis.password}"/>
<property name= "Poolconfig" ref= "Jedispoolconfig"/>
</bean>
<bean id= "Stringredistemplate" class= "Org.springframework.data.redis.core.StringRedisTemplate" >
<property name= "ConnectionFactory" >
<ref bean= "Jedisconnectionfactory"/>
</property>
</bean>
<!--configuration Springredis--
<bean id= "Springredis" class= "Com.inborn.inshop.common.redis.SpringRedis" >
<property name= "Rediskeyprefix" value= "${redis.key.prefix}"/>
<property name= "Stringredistemplate" >
<ref bean= "Stringredistemplate"/>
</property>
</bean>
</beans>
Spring Configuring Redis