AspectJ: parameter in a pointcut

后端 未结 5 1246
说谎
说谎 2021-01-01 01:54

I\'m using AspectJ to advice all the public methods which do have an argument of a chosen class. I tried the following:

pointcut permissionCheckMethods(Sessi         


        
5条回答
  •  猫巷女王i
    2021-01-01 02:33

    You have to use .. (double points) at the end and the beginning as follows:

    pointcut permissionCheckMethods(Session sess) : 
        (execution(public * *(.., Session , ..)) );
    

    Also get rid off && args(*, sess) because that means that you expect to catch only those methods with whatever type for first param but sess as second param and no more than 2 params as well..

提交回复
热议问题