Polishing

This commit is contained in:
Juergen Hoeller
2017-07-19 23:55:47 +02:00
parent 12978b8185
commit c752ba5b38
28 changed files with 228 additions and 233 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 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.
@@ -54,7 +54,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
}
/**
* Return the {@link CacheManager} that this instance use.
* Return the {@link CacheManager} that this instance uses.
*/
public CacheManager getCacheManager() {
return this.cacheManager;
@@ -62,7 +62,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
@Override
public void afterPropertiesSet() {
Assert.notNull(this.cacheManager, "CacheManager must not be null");
Assert.notNull(this.cacheManager, "CacheManager is required");
}
@@ -75,7 +75,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
else {
Collection<Cache> result = new ArrayList<Cache>();
for (String cacheName : cacheNames) {
Cache cache = this.cacheManager.getCache(cacheName);
Cache cache = getCacheManager().getCache(cacheName);
if (cache == null) {
throw new IllegalArgumentException("Cannot find cache named '" +
cacheName + "' for " + context.getOperation());
@@ -91,7 +91,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
* <p>It is acceptable to return {@code null} to indicate that no cache could
* be resolved for this invocation.
* @param context the context of the particular invocation
* @return the cache name(s) to resolve or {@code null} if no cache should be resolved
* @return the cache name(s) to resolve, or {@code null} if no cache should be resolved
*/
protected abstract Collection<String> getCacheNames(CacheOperationInvocationContext<?> context);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 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.
@@ -16,7 +16,6 @@
package org.springframework.cache.interceptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -34,13 +33,15 @@ public class NamedCacheResolver extends AbstractCacheResolver {
private Collection<String> cacheNames;
public NamedCacheResolver() {
}
public NamedCacheResolver(CacheManager cacheManager, String... cacheNames) {
super(cacheManager);
this.cacheNames = new ArrayList<String>(Arrays.asList(cacheNames));
}
public NamedCacheResolver() {
}
/**
* Set the cache name(s) that this resolver should use.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2017 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.
@@ -17,6 +17,7 @@
package org.springframework.cache.support;
import java.util.Collection;
import java.util.Collections;
import org.springframework.cache.Cache;
@@ -29,7 +30,7 @@ import org.springframework.cache.Cache;
*/
public class SimpleCacheManager extends AbstractCacheManager {
private Collection<? extends Cache> caches;
private Collection<? extends Cache> caches = Collections.emptySet();
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2017 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.
@@ -51,7 +51,9 @@ public class TypeMismatchNamingException extends NamingException {
/**
* Construct a new TypeMismatchNamingException.
* @param explanation the explanation text
* @deprecated as of Spring Framework 4.3.10
*/
@Deprecated
public TypeMismatchNamingException(String explanation) {
super(explanation);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2017 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.
@@ -49,8 +49,8 @@ public class ScopedProxyTests {
private static final ClassPathResource OVERRIDE_CONTEXT = new ClassPathResource(CLASSNAME + "-override.xml", CLASS);
private static final ClassPathResource TESTBEAN_CONTEXT = new ClassPathResource(CLASSNAME + "-testbean.xml", CLASS);
/* SPR-2108 */
@Test
@Test // SPR-2108
public void testProxyAssignable() throws Exception {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(MAP_CONTEXT);

View File

@@ -6,16 +6,16 @@
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean" scope="request">
<aop:scoped-proxy proxy-target-class="false"/>
<property name="age" value="99"/>
</bean>
<aop:scoped-proxy proxy-target-class="false"/>
<property name="age" value="99"/>
</bean>
<bean class="org.springframework.beans.factory.config.PropertyOverrideConfigurer">
<property name="properties">
<map>
<entry key="testBean.sex" value="male"/>
</map>
</property>
</bean>
<bean class="org.springframework.beans.factory.config.PropertyOverrideConfigurer">
<property name="properties">
<map>
<entry key="testBean.sex" value="male"/>
</map>
</property>
</bean>
</beans>