6

Assuming my current package structure in a spring projects as :

com.stackoverflow
|- service
|- entities
|- controllers
   |- package1
   |- package2
|-util

How can I apply an aspect to all the packages under com.stackoverflow except on the package util?

Applying it to everything, the execution expression would be "com.stackoverflow...(..)"

What should the execution expression be in this case I want to remove the util subpackage from the execution expression?

4

2 回答 2

10

在表达式中使用 AND&&和 NOT!运算符Pointcut作为

@Pointcut ("execution (* com.stackoverflow..*.*(..)) && " +
           "!execution (* com.stackoverflow.util..*.*(..))")
于 2013-06-18T21:57:55.567 回答
2

这个怎么样:

pointcut="execution(* com.stackoverflow.*.*(..)) && !execution(* com.stackoverflow.util.*.*(..))"
于 2013-06-18T22:02:18.363 回答