SpringAOP获取切点方法的返回值类型

2,910 阅读1分钟
@Around("execution(* com.xx.xx..xx.xx.*.*(..))") 
public Object around(ProceedingJoinPoint joinPoint) { 
//类型转换,向下转型,必定成功,因为其内部的实现MethodSignatureImpl实现的就是MethodSignature接口 
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
//获取method对象 
Method method = signature.getMethod();
//获取方法的返回值的类型 
Class returnType= method.getReturnType();
}