annotation-cache-aspectj.xml 2.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<?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:aop="http://www.springframework.org/schema/aop"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:cache="http://www.springframework.org/schema/cache"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.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.xsd">


	<!--
	<aop:config>
		<aop:advisor advice-ref="debugInterceptor" pointcut="execution(* *..CacheableService.*(..))" order="1"/>
	</aop:config>
17

18 19 20 21 22 23 24
	<bean id="cacheAspect" class="org.springframework.cache.aspectj.AnnotationCacheAspect" factory-method="aspectOf">
		<property name="cacheManager" ref="cacheManager"/>
		<property name="cacheOperationSources" ref="annotationSource"/>
	</bean>

	<bean id="annotationSource" class="org.springframework.cache.annotation.AnnotationCacheOperationSource"/>
	-->
25 26 27 28

	<cache:annotation-driven mode="aspectj" key-generator="keyGenerator"/>

	<bean id="keyGenerator" class="org.springframework.cache.config.SomeKeyGenerator" />
29 30 31 32 33 34 35 36 37 38 39 40

	<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
		<property name="caches">
			<set>
				<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="default"/>
				<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="primary"/>
				<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="secondary"/>
			</set>
		</property>
	</bean>

	<bean id="debugInterceptor" class="org.springframework.aop.interceptor.DebugInterceptor"/>
41

42 43 44
	<bean id="service" class="org.springframework.cache.config.DefaultCacheableService"/>
	<bean id="classService" class="org.springframework.cache.config.AnnotatedClassCacheableService"/>

45
</beans>