Spring MethodInvocation始终从切入点表达式返回null

Spring MethodInvocation始终从切入点表达式返回null,spring,spring-aop,Spring,Spring Aop,我定义了一个切入点,如下所示: <aop:pointcut id="getAllDataCut" expression= "execution(* com.example.test.getAllData(com.example test.User)) and args(usr)" /> 我总是空的 请给我一些提示。 提前感谢因为您知道发送给该方法的参数,所以可以将它们作为aspect方法的参数: public void aspect(JoinPoint joinPoint,

我定义了一个切入点,如下所示:

<aop:pointcut id="getAllDataCut" expression=
   "execution(* com.example.test.getAllData(com.example test.User)) and args(usr)" />
我总是空的

请给我一些提示。
提前感谢

因为您知道发送给该方法的参数,所以可以将它们作为aspect方法的参数:

public void aspect(JoinPoint joinPoint, com.example.test.User user) {  
  // DO SOME THING WITH user  
}

如果要为具有不同参数的方法添加方面,可以从表达式中删除参数

谢谢您的回答,是否需要定义方面,与使用不带参数的方法相同。上面的表达式与参数有什么问题。上面的表达式假设您的aspect方法使用我提供的用户参数,您可以直接使用用户参数,而不是使用methodInvocation。getArguements()Hi Mohab,感谢您的回复,但是我只通过调用方法来获取此参数。因为我正在基于此参数在运行时构造变量。您可以发布您的方面方法签名吗?
public void aspect(JoinPoint joinPoint, com.example.test.User user) {  
  // DO SOME THING WITH user  
}