1<?xml version="1.0" encoding="UTF-8"?> 2<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xmlns:aop="http://www.springframework.org/schema/aop" 4 xmlns:p="http://www.springframework.org/schema/p" 5 xmlns:cache="http://www.springframework.org/schema/cache" 6 xmlns:context="http://www.springframework.org/schema/context" 7 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 8 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd 9 http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd 10 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> 11 12 13 <!-- 14 <aop:config> 15 <aop:advisor advice-ref="debugInterceptor" pointcut="execution(* *..CacheableService.*(..))" order="1"/> 16 </aop:config> 17 18 <bean id="cacheAspect" class="org.springframework.cache.aspectj.AnnotationCacheAspect" factory-method="aspectOf"> 19 <property name="cacheManager" ref="cacheManager"/> 20 <property name="cacheOperationSources" ref="annotationSource"/> 21 </bean> 22 23 <bean id="annotationSource" class="org.springframework.cache.annotation.AnnotationCacheOperationSource"/> 24 --> 25 26 <cache:annotation-driven mode="aspectj" key-generator="keyGenerator"/> 27 28 <bean id="keyGenerator" class="org.springframework.cache.config.SomeKeyGenerator" /> 29 30 <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager"> 31 <property name="caches"> 32 <set> 33 <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="default"/> 34 <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="primary"/> 35 <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="secondary"/> 36 </set> 37 </property> 38 </bean> 39 40 <bean id="debugInterceptor" class="org.springframework.aop.interceptor.DebugInterceptor"/> 41 42 <bean id="service" class="org.springframework.cache.config.DefaultCacheableService"/> 43 <bean id="classService" class="org.springframework.cache.config.AnnotatedClassCacheableService"/> 44 45</beans> 46