Affects: 5.2.12 Cannot execute Aspect function,
public interface ILogController {
@PostMapping
String post();
}
@RestController
public class LogController implements ILogController {
@Override
public String post() {
return "";
}
}
@Slf4j
@Aspect
public class PostMappingLogAspect {
@AfterReturning(value = "@annotation(mapping)", returning = "returnValue")
public void afterReturningTask(JoinPoint point, Object returnValue, PostMapping mapping) {
log.info("enter");
}
}
I guess org.springframework.aop.support.AopUtils line 242
if (!Proxy.isProxyClass(targetClass)) {
classes.add(ClassUtils.getUserClass(targetClass));
}
classes.addAll(ClassUtils.getAllInterfacesForClassAsSet(targetClass));
This order. Unable to trigger ShadowMatch,when I change the order,The condition cannot be met.
org.springframework.aop.aspectj.AspectJExpressionPointcut line 450
if (targetMethod != originalMethod && (shadowMatch == null ||
(shadowMatch.neverMatches() && Proxy.isProxyClass(targetMethod.getDeclaringClass())))) {
Comment From: snicoll
Duplicate of #27491