+ update aspectj cache aspects

+ update integration tests
This commit is contained in:
Costin Leau
2011-11-28 13:05:59 +00:00
parent 1e2f49104d
commit d10f2258e8
7 changed files with 717 additions and 30 deletions

View File

@@ -18,7 +18,9 @@ package org.springframework.cache.aspectj;
import org.springframework.cache.annotation.AnnotationCacheOperationSource;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
/**
* Concrete AspectJ cache aspect using Spring's @{@link Cacheable} annotation.
@@ -59,6 +61,20 @@ public aspect AnnotationCacheAspect extends AbstractCacheAspect {
private pointcut executionOfAnyPublicMethodInAtCacheEvictType() :
execution(public * ((@CacheEvict *)+).*(..)) && @this(CacheEvict);
/**
* Matches the execution of any public method in a type with the @{@link CachePut}
* annotation, or any subtype of a type with the {@code CachePut} annotation.
*/
private pointcut executionOfAnyPublicMethodInAtCachePutType() :
execution(public * ((@CachePut *)+).*(..)) && @this(CachePut);
/**
* Matches the execution of any public method in a type with the @{@link Caching}
* annotation, or any subtype of a type with the {@code Caching} annotation.
*/
private pointcut executionOfAnyPublicMethodInAtCachingType() :
execution(public * ((@Caching *)+).*(..)) && @this(Caching);
/**
* Matches the execution of any method with the @{@link Cacheable} annotation.
*/
@@ -71,6 +87,18 @@ public aspect AnnotationCacheAspect extends AbstractCacheAspect {
private pointcut executionOfCacheEvictMethod() :
execution(* *(..)) && @annotation(CacheEvict);
/**
* Matches the execution of any method with the @{@link CachePut} annotation.
*/
private pointcut executionOfCachePutMethod() :
execution(* *(..)) && @annotation(CachePut);
/**
* Matches the execution of any method with the @{@link Caching} annotation.
*/
private pointcut executionOfCachingMethod() :
execution(* *(..)) && @annotation(Caching);
/**
* Definition of pointcut from super aspect - matched join points will have Spring
* cache management applied.
@@ -78,8 +106,11 @@ public aspect AnnotationCacheAspect extends AbstractCacheAspect {
protected pointcut cacheMethodExecution(Object cachedObject) :
(executionOfAnyPublicMethodInAtCacheableType()
|| executionOfAnyPublicMethodInAtCacheEvictType()
|| executionOfAnyPublicMethodInAtCachePutType()
|| executionOfAnyPublicMethodInAtCachingType()
|| executionOfCacheableMethod()
|| executionOfCacheEvictMethod())
|| executionOfCacheEvictMethod()
|| executionOfCachePutMethod()
|| executionOfCachingMethod())
&& this(cachedObject);
}
}