ProceedingJoinPoint用法
获得切点对应的方法(Method)
本处Method指的是java.lang.reflect.Method
若切入点表达式是方法,则获得的是切入点方法的信息。若切入点表达式是注解,则获得的是使用了切入点注解的方法的信息。
@Around("pointCut()")
public Object around3(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
// 获取方法
Method method = methodSignature.getMethod();
// 获取请求参数
Object[] args = joinPoint.getArgs();
// 获取响应结果
Object res = pjp.proceed();
Object target = joinPoint.getTarget();
String name = target.getClass().getName(); // 获取全类名
// 参数名数组
String[] argNames = signature.getParameterNames();
return res;
}