I need a Spring AOP pointcut explanation

南笙酒味 提交于 2019-12-25 03:40:39

问题


I have seen two variations of pointcut patterns:

This

execution(* some.package.*.*(..))

and this

execution(* some.package.* *(..))

What is the meaning of the dot (or of it absence) between the last two *'s?


回答1:


This appendix defines grammar of the pointcut expression langauge. For the execution expression the rule is the following:

execution(MethodPattern)

where

MethodPattern = 
  [ModifiersPattern] TypePattern 
        [TypePattern . ] IdPattern (TypePattern | ".." , ... ) 
        [ throws ThrowsPattern ]

That means that if you have 3 expressions (separated by space) before "(", then the first is modifier, second is class and third is method name. But if you have 2 expressions before "(", then first will be class and second will be method name.



来源:https://stackoverflow.com/questions/5167702/i-need-a-spring-aop-pointcut-explanation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!