spring-cache.xml
2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?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"
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-4.1.xsd">
<cache:annotation-driven mode="proxy" cache-manager="cacheManager" proxy-target-class="false" order="1"/>
<bean id="cacheManager" class="org.springframework.cache.support.CompositeCacheManager">
<property name="cacheManagers">
<list>
<ref bean="local"/>
<ref bean="center"/>
</list>
</property>
<property name="fallbackToNoOpCache" value="true"/>
</bean>
<!--ehcache-->
<bean id="local" class="org.springframework.cache.ehcache.EhCacheCacheManager">
<property name="cacheManager" ref="ehcacheManager"/>
</bean>
<bean id="ehcacheManager" class="net.sf.ehcache.CacheManager">
<constructor-arg type="net.sf.ehcache.config.Configuration">
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.springframework.cache.ehcache.EhCacheManagerUtils" />
<property name="targetMethod" value="parseConfiguration" />
<property name="arguments">
<list>
<value>classpath:cache/ehcache.xml</value>
</list>
</property>
</bean>
</constructor-arg>
</bean>
<!-- delete
<bean id="ehcacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:cache/ehcache.xml"/>
</bean>
-->
<bean id="center" class="org.springframework.data.redis.cache.RedisCacheManager">
<constructor-arg>
<ref bean="redisTemplate"/>
</constructor-arg>
<property name="cacheNames">
<set>
<value>API_SIT</value>
<value>API_GZH</value>
<value>CST</value>
</set>
</property>
</bean>
</beans>