ApplicationContext-redis.xml 1.5 KB

123456789101112131415161718192021222324252627282930
  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:p="http://www.springframework.org/schema/p"
  5. xmlns:aop="http://www.springframework.org/schema/aop"
  6. xmlns:context="http://www.springframework.org/schema/context"
  7. xmlns:tx="http://www.springframework.org/schema/tx"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans
  9. http://www.springframework.org/schema/beans/spring-beans.xsd
  10. http://www.springframework.org/schema/aop
  11. http://www.springframework.org/schema/aop/spring-aop.xsd
  12. http://www.springframework.org/schema/context
  13. http://www.springframework.org/schema/context/spring-context.xsd
  14. http://www.springframework.org/schema/tx
  15. http://www.springframework.org/schema/tx/spring-tx.xsd
  16. ">
  17. <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
  18. <property name="connectionFactory" ref="connectionFactory" />
  19. </bean>
  20. <bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
  21. p:host-name="${redis.host}" p:port="${redis.port}" p:password="${redis.pass}" p:pool-config-ref="poolConfig"/>
  22. <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
  23. <property name="maxIdle" value="${redis.maxIdle}" />
  24. <property name="testOnBorrow" value="${redis.testOnBorrow}" />
  25. </bean>
  26. </beans>