MethodInvocation always returns null from pointcut expression
I defined one pointcut like below:
<aop:pointcut id="getAllDataCut" expression=
"execution(* com.example.test.getAllData(com.example test.User)) and args(usr)" />
When i call
final Object[] methodArgs= methodInvocation.getArguements();
i am getti开发者_运维技巧ng always null.
Please give some hints. Thanks in Advance
Since you know the arguments sent to the method, you can get them as parameter to your aspect method:
public void aspect(JoinPoint joinPoint, com.example.test.User user) {
// DO SOME THING WITH user
}
if you want to add aspect for methods with different arguments, you can remove the args from the expression
精彩评论