diff --git a/org.springframework.aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTest.java b/org.springframework.aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTest.java
index 27c4e6d7d86..81a7793fc8f 100644
--- a/org.springframework.aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTest.java
+++ b/org.springframework.aspects/src/test/java/org/springframework/cache/aspectj/AspectJAnnotationTest.java
@@ -16,6 +16,8 @@
package org.springframework.cache.aspectj;
+import org.junit.Assert;
+import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
@@ -30,4 +32,10 @@ public class AspectJAnnotationTest extends AbstractAnnotationTest {
protected ApplicationContext getApplicationContext() {
return new GenericXmlApplicationContext("/org/springframework/cache/config/annotation-cache-aspectj.xml");
}
+
+ @Test
+ public void testKeyStrategy() throws Exception {
+ AnnotationCacheAspect aspect = ctx.getBean("org.springframework.cache.config.internalCacheAspect", AnnotationCacheAspect.class);
+ Assert.assertSame(ctx.getBean("keyGenerator"), aspect.getKeyGenerator());
+ }
}
diff --git a/org.springframework.aspects/src/test/java/org/springframework/cache/config/SomeKeyGenerator.java b/org.springframework.aspects/src/test/java/org/springframework/cache/config/SomeKeyGenerator.java
new file mode 100644
index 00000000000..13364bdbd17
--- /dev/null
+++ b/org.springframework.aspects/src/test/java/org/springframework/cache/config/SomeKeyGenerator.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2002-2011 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cache.config;
+
+import org.springframework.cache.interceptor.DefaultKeyGenerator;
+
+public class SomeKeyGenerator extends DefaultKeyGenerator {
+
+}
diff --git a/org.springframework.aspects/src/test/java/org/springframework/cache/config/annotation-cache-aspectj.xml b/org.springframework.aspects/src/test/java/org/springframework/cache/config/annotation-cache-aspectj.xml
index 1fe6a684e7e..5aaaf6b2d7b 100644
--- a/org.springframework.aspects/src/test/java/org/springframework/cache/config/annotation-cache-aspectj.xml
+++ b/org.springframework.aspects/src/test/java/org/springframework/cache/config/annotation-cache-aspectj.xml
@@ -14,7 +14,7 @@
-
+
@@ -22,8 +22,10 @@
-->
-
-
+
+
+
+
@@ -36,8 +38,8 @@
-
+
-
\ No newline at end of file
+
diff --git a/org.springframework.context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java b/org.springframework.context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java
index 26a736dd41e..5cae8fdff48 100644
--- a/org.springframework.context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java
+++ b/org.springframework.context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java
@@ -76,7 +76,8 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
* Registers a
*
*
- *
+ *
+ *
*
*
*
@@ -89,6 +90,7 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
def.setBeanClassName(CACHE_ASPECT_CLASS_NAME);
def.setFactoryMethodName("aspectOf");
parseCacheManagerProperty(element, def);
+ CacheNamespaceHandler.parseKeyGenerator(element, def);
parserContext.registerBeanComponent(new BeanComponentDefinition(def, CACHE_ASPECT_BEAN_NAME));
}
}