redis.xml 1.0 KB

123456789101112131415161718192021222324
  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:p="http://www.springframework.org/schema/p"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans
  5. http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"
  6. default-autowire="byName">
  7. <!-- redis 相关配置 -->
  8. <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
  9. <property name="maxIdle" value="300" />
  10. <property name="maxWaitMillis" value="3000" />
  11. <property name="testOnBorrow" value="true" />
  12. </bean>
  13. <bean id="jedisConnectionFactory"
  14. class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
  15. p:host-name="${redis.host}" p:port="${redis.port}" p:pool-config-ref="jedisPoolConfig"
  16. p:database="0" />
  17. <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
  18. <property name="connectionFactory" ref="jedisConnectionFactory" />
  19. </bean>
  20. </beans>