Pointcut that will capture constructor calls

删除回忆录丶 提交于 2019-12-11 04:38:30

问题


I am trying to define a pointcut which will capture all the constructor calls, regardless of the modifier, return type, or class. I have used the following code

after():execution(* * * .new(..))

I am having an error :

Syntax error on token "*", "(" expected.

Can anybody suggest what may be the right approach?


回答1:


Just remove the middle star "*". It does not make sense to specify a return type for a constructor call because it is clear that the constructor will always return an instance of the class it is defined for.

after() : execution(* *.new(..))

BTW, you should also remove the whitespace before ".new".



来源:https://stackoverflow.com/questions/15797331/pointcut-that-will-capture-constructor-calls

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