Align caching AspectJ configuration

The `CacheResolver` and `ErrorHandler` features introduced in 4.1 were
not properly enabled in AspectJ mode. This commit adds more tests from
the regular proxy-based mode and align the AspectJ caching configuration.

Issue: SPR-14413
This commit is contained in:
Stephane Nicoll
2016-06-29 09:21:59 +02:00
parent 775ffbe10b
commit 6cd85ddde7
6 changed files with 396 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 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.
@@ -39,12 +39,18 @@ public class AspectJCachingConfiguration extends AbstractCachingConfiguration {
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationCacheAspect cacheAspect() {
AnnotationCacheAspect cacheAspect = AnnotationCacheAspect.aspectOf();
if (this.cacheManager != null) {
if (this.cacheResolver != null) {
cacheAspect.setCacheResolver(this.cacheResolver);
}
else if (this.cacheManager != null) {
cacheAspect.setCacheManager(this.cacheManager);
}
if (this.keyGenerator != null) {
cacheAspect.setKeyGenerator(this.keyGenerator);
}
if (this.errorHandler != null) {
cacheAspect.setErrorHandler(this.errorHandler);
}
return cacheAspect;
}