From 666037ec5ccf768ebeba23604e3ac6c5235db033 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sun, 1 Apr 2018 12:57:02 +0200 Subject: [PATCH] Pointcut checking directly against superclass in case of CGLIB subclass Issue: SPR-16675 --- .../java/org/springframework/aop/support/AopUtils.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java index f8974854a8..05e5327abe 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java @@ -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> 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; } }