Consistent bridge method handling in annotation post-processors

Issue: SPR-12495
Issue: SPR-12187
(cherry picked from commit d97add0)
This commit is contained in:
Juergen Hoeller
2014-12-22 13:44:01 +01:00
parent 4c5e17ec3e
commit ec3967a6c7
7 changed files with 120 additions and 78 deletions

View File

@@ -311,9 +311,9 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
private InjectionMetadata findResourceMetadata(String beanName, final Class<?> clazz) {
// Quick check on the concurrent map first, with minimal locking.
// Fall back to class name as cache key, for backwards compatibility with custom callers.
String cacheKey = (StringUtils.hasLength(beanName) ? beanName : clazz.getName());
// Quick check on the concurrent map first, with minimal locking.
InjectionMetadata metadata = this.injectionMetadataCache.get(cacheKey);
if (InjectionMetadata.needsRefresh(metadata, clazz)) {
synchronized (this.injectionMetadataCache) {
@@ -357,7 +357,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
if (method.getParameterTypes().length != 1) {
throw new IllegalStateException("@WebServiceRef annotation requires a single-arg method: " + method);
}
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method, clazz);
currElements.add(new WebServiceRefElement(method, pd));
}
else if (ejbRefClass != null && method.isAnnotationPresent(ejbRefClass)) {
@@ -367,7 +367,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
if (method.getParameterTypes().length != 1) {
throw new IllegalStateException("@EJB annotation requires a single-arg method: " + method);
}
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method, clazz);
currElements.add(new EjbRefElement(method, pd));
}
else if (method.isAnnotationPresent(Resource.class)) {
@@ -379,7 +379,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
throw new IllegalStateException("@Resource annotation requires a single-arg method: " + method);
}
if (!ignoredResourceTypes.contains(paramTypes[0].getName())) {
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method, clazz);
currElements.add(new ResourceElement(method, pd));
}
}