弹簧aop表达子包

时间:2012-05-15 06:33:51

标签: java spring aop spring-aop

我在类似

的类型周围写了一个spring aop表达式
@Around("execution(* com.mycomp.proj.parent.child1.*.*(..))
|| execution(* com.mycomp.proj.parent.child2.*.*(..))")

但是如果将在父(e.g.:com.mycomp.proj.parent.child3下创建它们,则此表达式不会应用于新包。如何开发包含这一点的表达式,不适用于直接位于父包中的类? (只能表达,只能应用于所有子包的类)

3 个答案:

答案 0 :(得分:0)

排除父母:

@Around("execution(* com.mycomp.proj.parent.*.*(..))
&& ! execution(* com.mycomp.proj.parent.*(..))")

答案 1 :(得分:0)

@Around(“执行(* com.mycomp.proj.parent.child1。(..)) ||执行(* com.mycomp.proj.parent.child2。(..))“)

答案 2 :(得分:0)

申请额外的时间段如下

@Around("execution(* com.mycomp.proj.parent..*.*(..))")

它将允许com.mycomp.proj.parent

的所有子包上的切入点