Spring Configuring Redis

Source: Internet
Author: User

<?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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.