Skip to content

Commit 666037e

Browse files
committed
Pointcut checking directly against superclass in case of CGLIB subclass
Issue: SPR-16675
1 parent 66a3a82 commit 666037e

File tree

1 file changed

+5
-4
lines changed
  • spring-aop/src/main/java/org/springframework/aop/support

1 file changed

+5
-4
lines changed

spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -237,13 +237,14 @@ public static boolean canApply(Pointcut pc, Class<?> targetClass, boolean hasInt
237237
}
238238

239239
Set<Class<?>> classes = new LinkedHashSet<>(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
240-
classes.add(targetClass);
240+
Class<?> userClass = ClassUtils.getUserClass(targetClass);
241+
classes.add(userClass);
241242
for (Class<?> clazz : classes) {
242243
Method[] methods = ReflectionUtils.getAllDeclaredMethods(clazz);
243244
for (Method method : methods) {
244245
if ((introductionAwareMethodMatcher != null &&
245-
introductionAwareMethodMatcher.matches(method, targetClass, hasIntroductions)) ||
246-
methodMatcher.matches(method, targetClass)) {
246+
introductionAwareMethodMatcher.matches(method, userClass, hasIntroductions)) ||
247+
methodMatcher.matches(method, userClass)) {
247248
return true;
248249
}
249250
}

0 commit comments

Comments
 (0)