Polishing

Issue: SPR-10807
This commit is contained in:
Juergen Hoeller 2013-08-06 02:05:49 +02:00
parent 9645799264
commit ce06d1391f
1 changed files with 5 additions and 8 deletions

View File

@ -129,9 +129,8 @@ public abstract class CacheAspectSupport implements InitializingBean {
public void afterPropertiesSet() { public void afterPropertiesSet() {
Assert.state(this.cacheManager != null, "'cacheManager' is required"); Assert.state(this.cacheManager != null, "'cacheManager' is required");
Assert.state(this.cacheOperationSource != null, "The 'cacheOperationSources' " Assert.state(this.cacheOperationSource != null, "The 'cacheOperationSources' property is required: " +
+ "property is required: If there are no cacheable methods, " "If there are no cacheable methods, then don't use a cache aspect.");
+ "then don't use a cache aspect.");
this.initialized = true; this.initialized = true;
} }
@ -155,7 +154,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
Collection<Cache> caches = new ArrayList<Cache>(cacheNames.size()); Collection<Cache> caches = new ArrayList<Cache>(cacheNames.size());
for (String cacheName : cacheNames) { for (String cacheName : cacheNames) {
Cache cache = this.cacheManager.getCache(cacheName); Cache cache = this.cacheManager.getCache(cacheName);
Assert.notNull(cache, "Cannot find cache named [" + cacheName + "] for " + operation); Assert.notNull(cache, "Cannot find cache named '" + cacheName + "' for " + operation);
caches.add(cache); caches.add(cache);
} }
return caches; return caches;
@ -249,8 +248,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
} }
} }
private void logInvalidating(CacheOperationContext context, private void logInvalidating(CacheOperationContext context, CacheEvictOperation operation, Object key) {
CacheEvictOperation operation, Object key) {
if (this.logger.isTraceEnabled()) { if (this.logger.isTraceEnabled()) {
this.logger.trace("Invalidating " + (key == null ? "entire cache" : "cache key " + key) + this.logger.trace("Invalidating " + (key == null ? "entire cache" : "cache key " + key) +
" for operation " + operation + " on method " + context.method); " for operation " + operation + " on method " + context.method);
@ -326,8 +324,7 @@ public abstract class CacheAspectSupport implements InitializingBean {
Method method, Object[] args, Object target, Class<?> targetClass) { Method method, Object[] args, Object target, Class<?> targetClass) {
for (CacheOperation operation : operations) { for (CacheOperation operation : operations) {
this.contexts.add(operation.getClass(), new CacheOperationContext(operation, this.contexts.add(operation.getClass(), new CacheOperationContext(operation, method, args, target, targetClass));
method, args, target, targetClass));
} }
} }