diff --git a/org.springframework.context/src/main/java/org/springframework/cache/interceptor/LazyParamAwareEvaluationContext.java b/org.springframework.context/src/main/java/org/springframework/cache/interceptor/LazyParamAwareEvaluationContext.java index 5227e43b4c..c8c3e27905 100644 --- a/org.springframework.context/src/main/java/org/springframework/cache/interceptor/LazyParamAwareEvaluationContext.java +++ b/org.springframework.context/src/main/java/org/springframework/cache/interceptor/LazyParamAwareEvaluationContext.java @@ -97,6 +97,7 @@ class LazyParamAwareEvaluationContext extends StandardEvaluationContext { // save arguments as indexed variables for (int i = 0; i < this.args.length; i++) { + setVariable("a" + i, this.args[i]); setVariable("p" + i, this.args[i]); } diff --git a/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java b/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java index 573a5d8ffc..80fa6f50e2 100644 --- a/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java +++ b/org.springframework.context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java @@ -116,7 +116,7 @@ public class AnnotatedClassCacheableService implements CacheableService return counter.getAndIncrement(); } - @Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#p0"), @CacheEvict(value = "primary", key = "#p0 + 'A'") }) + @Caching(evict = { @CacheEvict("primary"), @CacheEvict(value = "secondary", key = "#a0"), @CacheEvict(value = "primary", key = "#p0 + 'A'") }) public Object multiEvict(Object arg1) { return counter.getAndIncrement(); } @@ -126,7 +126,7 @@ public class AnnotatedClassCacheableService implements CacheableService return counter.getAndIncrement(); } - @Caching(cacheable = { @Cacheable(value = "primary", condition = "#p0 == 3") }, evict = { @CacheEvict("secondary") }) + @Caching(cacheable = { @Cacheable(value = "primary", condition = "#a0 == 3") }, evict = { @CacheEvict("secondary") }) public Object multiConditionalCacheAndEvict(Object arg1) { return counter.getAndIncrement(); } diff --git a/spring-framework-reference/src/cache.xml b/spring-framework-reference/src/cache.xml index 690c96c2f7..e48b750c87 100644 --- a/spring-framework-reference/src/cache.xml +++ b/spring-framework-reference/src/cache.xml @@ -195,10 +195,10 @@ public Book findBook(String name)]]> #root.targetClass - params + args root object The arguments (as array) used for invoking the target - #root.params[0] + #root.args[0] caches @@ -207,12 +207,12 @@ public Book findBook(String name)]]> #root.caches[0].name - parameter name + argument name evaluation context - Name of any of the method parameter. If for some reason the names are not available (ex: no debug information), - the parameter names are also available under the ]]> where - stands for the parameter index (starting from 0). - iban or p0 + Name of any of the method argument. If for some reason the names are not available (ex: no debug information), + the argument names are also available under the ]]> where + stands for the argument index (starting from 0). + iban or a0 (one can also use p0 or ]]> notation as an alias).