123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?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:p="http://www.springframework.org/schema/p"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:cache="http://www.springframework.org/schema/cache"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/cache
- http://www.springframework.org/schema/cache/spring-cache.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-4.1.xsd">
- <cache:annotation-driven cache-manager="redisCacheManager" />
-
- <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
- <property name="maxTotal" value="${redis.pool.maxTotal}" />
- <property name="maxIdle" value="${redis.pool.maxIdle}" />
- <!-- <property name="maxWait" value="${redis.pool.maxWait}" /> -->
- <property name="testOnBorrow" value="${redis.pool.testOnBorrow}" />
- </bean>
-
- <bean class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration" />
-
- <!-- <bean id="shardedJedisPool" class="redis.clients.jedis.ShardedJedisPool" scope="singleton"> -->
- <!-- <constructor-arg index="0" ref="jedisPoolConfig" /> -->
- <!-- <constructor-arg index="1"> -->
- <!-- <list> -->
- <!-- <bean class="redis.clients.jedis.JedisShardInfo"> -->
- <!-- <constructor-arg name="host" value="${redis.hostname}" /> -->
- <!-- <constructor-arg name="port" value="${redis.port}" /> -->
- <!-- <constructor-arg name="timeout" value="${redis.timeout}" /> -->
- <!-- <constructor-arg name="weight" value="1" /> -->
- <!-- <property name="password" value="${redis.password}" /> -->
- <!-- </bean> -->
- <!-- </list> -->
- <!-- </constructor-arg> -->
- <!-- </bean> -->
- <bean id="jedisConnectionFactory"
- class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
- <property name="hostName" value="${redis.hostname}" />
- <property name="port" value="${redis.port}" />
- <property name="password" value="${redis.password}" />
- <property name="poolConfig" ref="jedisPoolConfig" />
- </bean>
- <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
- p:connection-factory-ref="jedisConnectionFactory" />
- <bean id="redisCacheManager" class="org.springframework.data.redis.cache.RedisCacheManager">
- <constructor-arg ref="redisTemplate"></constructor-arg>
- <property name="usePrefix" value="true" />
- <property name="defaultExpiration" value="${redis.expiration}" />
- </bean>
- </beans>
|