Browse Source

Pointcut checking directly against superclass in case of CGLIB subclass

Issue: SPR-16675
pull/1772/head
Juergen Hoeller 7 years ago
parent
commit
666037ec5c
  1. 9
      spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java

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

@ -1,5 +1,5 @@ @@ -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 { @@ -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;
}
}

Loading…
Cancel
Save