使用joinpoint.getSignature().getName()只能得到方法名,而如果使用反射通过类和方法名去得到拦截的method对象很麻烦,而且容易出问题,难道在spring2.0中使用Aspect方式进行AOP没有别的方法得到拦截的method对象吗,就象spring1里一样,有个method对象参数。
[url]http://www.nabble.com/Sring-AOP---ProceedingJoinPoint---Method-td20042019.html(必须用代理上)[/url]
看看这个,貌似可以这么做,
[code="java"]
Signature signature = a_joinPoint.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
try
{
Object[] arguments = a_joinPoint.getArgs();
result = method.invoke(mock, arguments);
s_logger.debug("Mocking " + formatCall(a_joinPoint));
}
catch (InvocationTargetException e)
{
s_logger.debug("Failed to delegate to mock: "
+ formatCall(a_joinPoint), e);
throw e.getTargetException();
}
[/code]