Skip to content

Commit

Permalink
add spring data reids and cache
Browse files Browse the repository at this point in the history
  • Loading branch information
keda committed Jul 10, 2015
1 parent 86bdb18 commit 55cddc4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@

<!-- Httpclient related beans -->
<beans:import resource="httpclient-beans.xml"/>

<!-- cache related beans -->
<beans:import resource="cache-beans.xml"/>
</beans:beans>

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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:cache="http://www.springframework.org/schema/cache"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:c="http://www.springframework.org/schema/c"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd">

<cache:annotation-driven cache-manager="cacheManager"/>

<bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager"
c:template-ref="redisTemplate">
</bean>

</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,21 @@
<!-- <constructor-arg name="password" value="${redis.password}"/> -->
</bean>

<bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
<constructor-arg name="poolConfig" ref="jedisPool"/>
<property name="usePool" value="true"/>
</bean>

<bean id="jackson2JsonRedisSerializer" class="org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer">
<property name="objectMapper" ref="pageListJsonMapper"/>
</bean>

<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
<property name="connectionFactory" ref="jedisConnectionFactory"/>
<property name="defaultSerializer" ref="jackson2JsonRedisSerializer"/>
<property name="enableDefaultSerializer" value="true"/>
<property name="enableTransactionSupport" value="true"/>
</bean>

</beans>

0 comments on commit 55cddc4

Please sign in to comment.