最佳答案
以下按预期工作(Java 8 Spring 5.0.4 AspectJ 1.8.13):
原文链接:https://www.f2er.com/spring/431603.html@Aspect
@Component
public class SomeAspect {
@Around("@annotation(SomeAnnotation)")
public Object aroundAdvice(ProceedingJoinPoint joinPoint) throws Throwable {
CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature();
System.out.println("First parameter's name: " + codeSignature.getParameterNames()[0]);
System.out.println("First argument's value: " + joinPoint.getArgs()[0]);
return joinPoint.proceed();
}
}