InjectionMetadata caching per bean name needs to refresh when bean class changes

Issue: SPR-11246
This commit is contained in:
Juergen Hoeller
2013-12-20 00:15:09 +01:00
parent a115a7dad5
commit 08aa22ff1f
4 changed files with 14 additions and 9 deletions

View File

@@ -314,10 +314,10 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
// Fall back to class name as cache key, for backwards compatibility with custom callers.
String cacheKey = (StringUtils.hasLength(beanName) ? beanName : clazz.getName());
InjectionMetadata metadata = this.injectionMetadataCache.get(cacheKey);
if (metadata == null) {
if (InjectionMetadata.needsRefresh(metadata, clazz)) {
synchronized (this.injectionMetadataCache) {
metadata = this.injectionMetadataCache.get(cacheKey);
if (metadata == null) {
if (InjectionMetadata.needsRefresh(metadata, clazz)) {
LinkedList<InjectionMetadata.InjectedElement> elements = new LinkedList<InjectionMetadata.InjectedElement>();
Class<?> targetClass = clazz;
@@ -606,7 +606,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
}
if (StringUtils.hasLength(this.wsdlLocation)) {
try {
Constructor<?> ctor = this.lookupType.getConstructor(new Class[] {URL.class, QName.class});
Constructor<?> ctor = this.lookupType.getConstructor(new Class<?>[] {URL.class, QName.class});
WebServiceClient clientAnn = this.lookupType.getAnnotation(WebServiceClient.class);
if (clientAnn == null) {
throw new IllegalStateException("JAX-WS Service class [" + this.lookupType.getName() +