Skip to content

Commit 88cac6a

Browse files
committed
Reduce creation of composite interfaces to actual method references in current pointcut
Closes gh-29519
1 parent 11df955 commit 88cac6a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 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.
@@ -422,7 +422,8 @@ private void bindParameters(ProxyMethodInvocation invocation, JoinPointMatch jpm
422422

423423
private ShadowMatch getTargetShadowMatch(Method method, Class<?> targetClass) {
424424
Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass);
425-
if (targetMethod.getDeclaringClass().isInterface()) {
425+
if (targetMethod.getDeclaringClass().isInterface() && targetMethod.getDeclaringClass() != targetClass &&
426+
obtainPointcutExpression().getPointcutExpression().contains("." + targetMethod.getName() + "(")) {
426427
// Try to build the most specific interface possible for inherited methods to be
427428
// considered for sub-interface matches as well, in particular for proxy classes.
428429
// Note: AspectJ is only going to take Method.getDeclaringClass() into account.

0 commit comments

Comments
 (0)