Pointcut checking directly against superclass in case of CGLIB subclass

Issue: SPR-16675
This commit is contained in:
Juergen Hoeller
2018-04-01 12:57:02 +02:00
parent 66a3a82fb3
commit 666037ec5c

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -237,13 +237,14 @@ public abstract class AopUtils {
}
Set<Class<?>> classes = new LinkedHashSet<>(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
classes.add(targetClass);
Class<?> userClass = ClassUtils.getUserClass(targetClass);
classes.add(userClass);
for (Class<?> clazz : classes) {
Method[] methods = ReflectionUtils.getAllDeclaredMethods(clazz);
for (Method method : methods) {
if ((introductionAwareMethodMatcher != null &&
introductionAwareMethodMatcher.matches(method, targetClass, hasIntroductions)) ||
methodMatcher.matches(method, targetClass)) {
introductionAwareMethodMatcher.matches(method, userClass, hasIntroductions)) ||
methodMatcher.matches(method, userClass)) {
return true;
}
}