提交 354c3e03 编写于 作者: J Juergen Hoeller

Refined exclusion of bridge methods in annotation post-processors (for Java 8 compatibility)

Issue: SPR-12187
(cherry picked from commit 29abca53)
上级 cc29db4c
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册