aop – 如何从aspectj中排除方法

我正在尝试使用aspectj从日志文件中排除几种方法(我只使用 spring和Load-time编织).有没有办法列出aop.xml中的排除方法?我知道我可以为全班做这个,但我正在寻找具体的方法.或者我可以在方面类中列出一个列表?
谢谢

解决方法

我不知道如何在 XML中做到这一点,但是在方面本身很容易做到这一点,因为可以使用布尔运算符组合切入点.

传统的aspectj语法:

pointcut whatIDontWantTomatch() : within(SomeClass+) || execution(* @SomeAnnotation *.*(..));
pointcut whatIWantTomatch()     : execution(* some.pattern.here.*(..));
pointcut allIWantTomatch()      : whatIWantTomatch() && ! whatIDontWantTomatch();

@AspectJ语法:

@pointcut("within(SomeClass+) || execution(* @SomeAnnotation *.*(..))")
public void whatIDontWantTomatch(){}
@pointcut("execution(* some.pattern.here.*(..))")
public void whatIWantTomatch(){}
@pointcut("whatIWantTomatch() && ! whatIDontWantTomatch()")
public void allIWantTomatch(){}

这些当然只是样品. whatIDontWantTomatch()也可以由几个切入点等组成.

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...