我尝试在com.abc.def.controller
建议中针对特定包如com.abc.def.service.serviceImpl
,@Around
等的切入点表达式为:
@Around("execution(* com.abc.def.controller..*.*(..))")
@Around("execution(* com.abc.def.service.*Impl.*(..))")
我还需要匹配
com.abc.xyz.controller
,com.abc.xyz.service.serviceImpl
等不同程序包中的方法,并尝试了许多切入点表达式,但没有用。任何帮助将不胜感激。 :)
最佳答案
这个怎么样?
@Around("execution(* com.abc..controller..*(..))")
@Around("execution(* com.abc..service.*Impl.*(..))")
您也可以像这样一次匹配两个:
@Around(
"execution(* com.abc..controller..*(..)) || " +
"execution(* com.abc..service.*Impl.*(..))"
)
其他变体是可能的,具体取决于您要实现的目标。随时提出相关的后续问题。