注釈付きメソッドへのポイントカットでアスペクトを作成しました。私が得るの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
メソッドの実装に追加されている場合、注釈はありません。正しいポイントカットは何でしょうか?