考慮這個@PointCut
如果一個方法是用@Secure
註解其被觸發:直接或在繼承的接口中註釋的切入點匹配方法?
@Pointcut("execution(@Secure * *(..)) && @annotation(secure)")
public void accessOperation(final Access access) { }
這工作得很好了類似的方法:
class Foo {
@Secure
public void secureMethod() { }
}
但是,它可能有一個Pointcut
這也當註釋只存在於像這樣的超類/接口中時被觸發?
interface Foo {
@Secure
public void secureMethod();
}
class SubFoo implements Foo {
@Override
public void secureMethod() { // <--- execution of this method should be caught
/* .... */
}
}
編輯:
這似乎是很密切的關係:@AspectJ pointcut for subclasses of a class with an annotation
唯一的區別是,他們使用一類級別的註解,而我需要一個方法級的註釋。
嚴格來說,這個問題重複[@AspectJ切入點的方法重寫與註釋的接口方法](http://stackoverflow.com/questions/7178782/aspectj-pointcut-for-methods-that-override-an -interface-method-with-an-annotatio) – alehro