within 不需要,spring aop.execution(* concert.Performance.perform(..)) && within(concert.*)
within is not necessary,spring aop.execution(* concert.Performance.perform(..)) && within(concert.*)
书中"spring in action",有一个aspectj表达式:
execution(* concert.Performance.perform(..)) && within(concert.*)
execution() 匹配作为方法执行的连接点。
您将 execution() 指示符用于 select Performance 的 perform() 方法。
execution(* concert.Performance.perform(..))
within() 将匹配限制为特定类型内的连接点。
您希望将该切入点的范围仅限于音乐会包。
within(concert.*)
但我认为,表达式的左半部分和右半部分都匹配连接点,"* concert.Performance.perform(..)"表示连接点必须在一个class "Performance",已经在"concert"包里了,那么"within(concert.*)"有什么用呢?
如果它是 "or",可能有用,但它是 "and"。
在这种情况下 within(concert.*)
很重要,结果将与 execution(* concert.Performance.perform(..))
不同
执行它匹配方法。
其中匹配类型。
在这个例子中你已经执行了切入点 -- 对于方法的任何参数
使用任何访问修饰符执行并添加 'specific type' - within(concert.*)
所以你的切入点是--
execution(* concert.Performance.perform(..)) && within(concert.*)
for ant return type , for method perform from class Performance 来自 package concert
消耗 包和子包 concert
的任何类型
如果你只有 execution(* concert.Performance.perform(..))
它几乎与以前的相同,除了类型可以是任何
书中"spring in action",有一个aspectj表达式:
execution(* concert.Performance.perform(..)) && within(concert.*)
execution() 匹配作为方法执行的连接点。
您将 execution() 指示符用于 select Performance 的 perform() 方法。
execution(* concert.Performance.perform(..))
within() 将匹配限制为特定类型内的连接点。
您希望将该切入点的范围仅限于音乐会包。
within(concert.*)
但我认为,表达式的左半部分和右半部分都匹配连接点,"* concert.Performance.perform(..)"表示连接点必须在一个class "Performance",已经在"concert"包里了,那么"within(concert.*)"有什么用呢?
如果它是 "or",可能有用,但它是 "and"。
在这种情况下 within(concert.*)
很重要,结果将与 execution(* concert.Performance.perform(..))
执行它匹配方法。
其中匹配类型。
在这个例子中你已经执行了切入点 -- 对于方法的任何参数
使用任何访问修饰符执行并添加 'specific type' - within(concert.*)
所以你的切入点是--
execution(* concert.Performance.perform(..)) && within(concert.*)
for ant return type , for method perform from class Performance 来自 package concert
消耗 包和子包 concert
如果你只有 execution(* concert.Performance.perform(..))
它几乎与以前的相同,除了类型可以是任何