内是没有必要的,春天AOP.执行(*音乐会。Performance.perform(..))&& 内(音乐会*)



在《春天在行动》一书中,有一个方面表达:

execution(* concert.Performance.perform(..)) && within(concert.*)

execution(( 匹配作为方法执行的联接点。
您可以使用 execution(( 指示符来选择 Performance 的 perform(( 方法。

execution(* concert.Performance.perform(..))

within(( 限制匹配以连接特定类型中的点。
您希望将该切入点的范围限制在音乐会套餐中。

within(concert.*)

但我认为,左部分和右部分的表达都匹配点,"*音乐会。Performance.perform(..("表示加入点必须在一个类"Performance"中,它已经在包"concert"中,那么"within(concert.*("有什么用呢?
如果是"或",也许有用,但它是"和"。

在这种情况下within(concert.*)很重要,结果不会与仅使用execution(* concert.Performance.perform(..))

执行它与方法匹配。

在它与类型匹配。

在此示例中,您已经执行了 Poincut -- 对于方法的任何参数 使用任何访问修饰符执行,然后添加"特定类型" -within(concert.*)

所以你的一品红是——

execution(* concert.Performance.perform(..)) && within(concert.*)

对于任何返回类型,对于方法从类执行性能来自使用任何类型的package concert从包和子包音乐会

如果您刚刚execution(* concert.Performance.perform(..))它几乎与以前的相同,除了该类型可以通过任何

最新更新