redis2.xml 1.4 KB

1234567891011121314151617181920212223242526272829303132
  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"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
  8. <!--Jedis连接池的相关配置-->
  9. <bean id="jedisPoolConfig2" class="redis.clients.jedis.JedisPoolConfig">
  10. <!--新版是maxTotal,旧版是maxActive-->
  11. <property name="maxTotal">
  12. <value>${redis.pool.maxActive}</value>
  13. </property>
  14. <property name="maxIdle">
  15. <value>${redis.pool.maxIdle}</value>
  16. </property>
  17. <property name="testOnBorrow" value="false"/>
  18. <property name="testOnReturn" value="false"/>
  19. </bean>
  20. <bean id="jedisPool2" class="redis.clients.jedis.JedisPool" depends-on="jedisPoolConfig">
  21. <constructor-arg name ="poolConfig" ref="jedisPoolConfig2" ></constructor-arg>
  22. <constructor-arg name="host" value="${redis.host}" />
  23. <constructor-arg name="port" value="${redis.port2}" type="int" />
  24. <constructor-arg name="timeout" value="${redis.timeout}" type="int" />
  25. </bean>
  26. </beans>