我创建了一个带有注释方法的切入点的 Aspect。我得到的JoinPoint
是来自接口的方法声明而不是方法实现。因此,当我想获取带注释的方法参数时,我必须在接口中添加注释而不是在实现中。
@AfterReturning(value = "@annotation(pl.styall.scylla.security.authorization.acl.AclSecure) && @annotation(aclSecure)", argNames = "jp,aclSecure,retVal", returning = "retVal")
public void addObjectAndEntry(JoinPoint jp, AclSecure aclSecure,
Object retVal) {
System.out.println(jp.toLongString());
MethodSignature signature = (MethodSignature) jp.getSignature();
Method method = signature.getMethod();
Annotation[][] methodAnnotations = method.getParameterAnnotations();
methodAnnotations
如果在方法实现中添加它们,则没有注释。什么是正确的切入点?