Refined exclusion of bridge methods in annotation post-processors (for Java 8 compatibility)
Issue: SPR-12187
(cherry picked from commit 29abca5
)
This commit is contained in:
parent
cc29db4c50
commit
354c3e03e9
|
@ -391,10 +391,15 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
|||
}
|
||||
}
|
||||
for (Method method : targetClass.getDeclaredMethods()) {
|
||||
AnnotationAttributes ann = null;
|
||||
Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(method);
|
||||
AnnotationAttributes ann = BridgeMethodResolver.isVisibilityBridgeMethodPair(method, bridgedMethod) ?
|
||||
findAutowiredAnnotation(bridgedMethod) : findAutowiredAnnotation(method);
|
||||
if (ann != null && !method.isBridge() && method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
|
||||
if (BridgeMethodResolver.isVisibilityBridgeMethodPair(method, bridgedMethod)) {
|
||||
ann = findAutowiredAnnotation(bridgedMethod);
|
||||
}
|
||||
else if (!method.isBridge()) {
|
||||
ann = findAutowiredAnnotation(method);
|
||||
}
|
||||
if (ann != null && method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
|
||||
if (Modifier.isStatic(method.getModifiers())) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Autowired annotation is not supported on static methods: " + method);
|
||||
|
|
Loading…
Reference in New Issue