Local merged annotation lookup in SpringCacheAnnotationParser
Issue: SPR-14781 Issue: SPR-14801
This commit is contained in:
@@ -244,6 +244,22 @@ public class AnnotationCacheOperationSourceTests {
|
||||
assertSharedConfig(cacheOperation, "", "", "", "myCache");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cacheConfigFromInterface() {
|
||||
assertNull(getOps(InterfaceCacheConfig.class, "interfaceCacheConfig"));
|
||||
Collection<CacheOperation> ops = getOps(CacheConfigIfc.class, "interfaceCacheConfig");
|
||||
CacheOperation cacheOperation = ops.iterator().next();
|
||||
assertSharedConfig(cacheOperation, "", "", "", "myCache");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cacheAnnotationOverride() {
|
||||
Collection<CacheOperation> ops = getOps(InterfaceCacheConfig.class, "interfaceCacheableOverride");
|
||||
assertSame(1, ops.size());
|
||||
CacheOperation cacheOperation = ops.iterator().next();
|
||||
assertTrue(cacheOperation instanceof CacheableOperation);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void partialClassLevelWithCustomCacheManager() {
|
||||
Collection<CacheOperation> ops = getOps(AnnotatedClassWithSomeDefault.class, "methodLevelCacheManager", 1);
|
||||
@@ -430,7 +446,7 @@ public class AnnotationCacheOperationSourceTests {
|
||||
|
||||
|
||||
@CacheConfigFoo
|
||||
@CacheConfig(cacheNames = "myCache") // multiple sources
|
||||
@CacheConfig(cacheNames = "myCache") // multiple sources
|
||||
private static class MultipleCacheConfig {
|
||||
|
||||
@Cacheable
|
||||
@@ -439,6 +455,30 @@ public class AnnotationCacheOperationSourceTests {
|
||||
}
|
||||
|
||||
|
||||
@CacheConfig(cacheNames = "myCache")
|
||||
private interface CacheConfigIfc {
|
||||
|
||||
@Cacheable
|
||||
void interfaceCacheConfig();
|
||||
|
||||
@CachePut
|
||||
void interfaceCacheableOverride();
|
||||
}
|
||||
|
||||
|
||||
private static class InterfaceCacheConfig implements CacheConfigIfc {
|
||||
|
||||
@Override
|
||||
public void interfaceCacheConfig() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable
|
||||
public void interfaceCacheableOverride() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@Cacheable("foo")
|
||||
@@ -491,7 +531,7 @@ public class AnnotationCacheOperationSourceTests {
|
||||
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Cacheable(cacheNames = "shadowed cache name", key = "shadowed key")
|
||||
@interface ComposedCacheable {
|
||||
|
||||
@@ -507,7 +547,7 @@ public class AnnotationCacheOperationSourceTests {
|
||||
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@CacheEvict(cacheNames = "shadowed cache name", key = "shadowed key")
|
||||
@interface ComposedCacheEvict {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user