redis.xml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
  4. xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
  5. xsi:schemaLocation="
  6. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  7. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
  8. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
  9. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
  10. ">
  11. <!--Jedis连接池的相关配置-->
  12. <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
  13. <!--新版是maxTotal,旧版是maxActive-->
  14. <property name="maxTotal">
  15. <value>${redis.pool.maxTotal}</value>
  16. </property>
  17. <property name="maxIdle">
  18. <value>${redis.pool.maxIdle}</value>
  19. </property>
  20. <property name="testOnBorrow" value="true"/>
  21. <property name="testOnReturn" value="true"/>
  22. </bean>
  23. <bean id="jedisPool" class="redis.clients.jedis.JedisPool">
  24. <constructor-arg name="poolConfig" ref="jedisPoolConfig" />
  25. <constructor-arg name="host" value="${redis.host}" />
  26. <constructor-arg name="port" value="${redis.port}" type="int" />
  27. <constructor-arg name="timeout" value="${redis.timeout}" type="int" />
  28. </bean>
  29. </beans>