Polishing

This commit is contained in:
Juergen Hoeller
2018-07-19 13:47:03 +02:00
parent 322b0f431f
commit 22fc3255b7
10 changed files with 55 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2018 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.
@@ -37,12 +37,12 @@ public class CachingConfigurerSupport implements CachingConfigurer {
}
@Override
public KeyGenerator keyGenerator() {
public CacheResolver cacheResolver() {
return null;
}
@Override
public CacheResolver cacheResolver() {
public KeyGenerator keyGenerator() {
return null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -110,21 +110,21 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
*/
private static void parseCacheResolution(Element element, BeanDefinition def, boolean setBoth) {
String name = element.getAttribute("cache-resolver");
if (StringUtils.hasText(name)) {
boolean hasText = StringUtils.hasText(name);
if (hasText) {
def.getPropertyValues().add("cacheResolver", new RuntimeBeanReference(name.trim()));
}
if (!StringUtils.hasText(name) || setBoth) {
if (!hasText || setBoth) {
def.getPropertyValues().add("cacheManager",
new RuntimeBeanReference(CacheNamespaceHandler.extractCacheManager(element)));
}
}
private static BeanDefinition parseErrorHandler(Element element, BeanDefinition def) {
private static void parseErrorHandler(Element element, BeanDefinition def) {
String name = element.getAttribute("error-handler");
if (StringUtils.hasText(name)) {
def.getPropertyValues().add("errorHandler", new RuntimeBeanReference(name.trim()));
}
return def;
}
@@ -173,12 +173,12 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
}
/**
* Registers a
* Registers a cache aspect.
* <pre class="code">
* <bean id="cacheAspect" class="org.springframework.cache.aspectj.AnnotationCacheAspect" factory-method="aspectOf">
* <property name="cacheManager" ref="cacheManager"/>
* <property name="keyGenerator" ref="keyGenerator"/>
* </bean>
* &lt;bean id="cacheAspect" class="org.springframework.cache.aspectj.AnnotationCacheAspect" factory-method="aspectOf"&gt;
* &lt;property name="cacheManager" ref="cacheManager"/&gt;
* &lt;property name="keyGenerator" ref="keyGenerator"/&gt;
* &lt;/bean&gt;
* </pre>
*/
private static void registerCacheAspect(Element element, ParserContext parserContext) {

View File

@@ -207,8 +207,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
}
catch (NoUniqueBeanDefinitionException ex) {
throw new IllegalStateException("No CacheResolver specified, and no unique bean of type " +
"CacheManager found. Mark one as primary (or give it the name 'cacheManager') or " +
"declare a specific CacheManager to use, that serves as the default one.");
"CacheManager found. Mark one as primary or declare a specific CacheManager to use.");
}
catch (NoSuchBeanDefinitionException ex) {
throw new IllegalStateException("No CacheResolver specified, and no bean of type CacheManager found. " +
@@ -651,6 +650,9 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
}
/**
* A {@link CacheOperationInvocationContext} context for a {@link CacheOperation}.
*/
protected class CacheOperationContext implements CacheOperationInvocationContext<CacheOperation> {
private final CacheOperationMetadata metadata;