我正在使用Spring AOP更改返回值。但是我发现@Around函数的返回值不是方法返回值。如何解决此问题?
控制器
Page<Object> page = PageHelper.startPage(pageNo, pageSize, true);
CallRecordEntity callRecordParam = new CallRecordEntity();
BeanUtils.copyProperties(callRecordVO, callRecordParam);
callRecordParam.setEnterpriseId(ThreadCacheMgr.getEntId());
List<CallRecordEntity> list = callRecordService.callList(callRecordParam);
服务
@Override
@SensitiveInfo(SensitiveInfoType.CALL_RECORD)
public List<CallRecordEntity> callList(CallRecordEntity callRecordEntity) {
}
@Pointcut("@annotation(com.zhexinit.aicc.common.annotation.SensitiveInfo)")
public void sensitiveInfoAspect() {
}
@Around("sensitiveInfoAspect()")
public Object process(ProceedingJoinPoint point) throws Throwable {
UserCacheVO userCacheVO = (UserCacheVO) SecurityContextHolder.getContext().getAuthentication()
.getPrincipal();
Object ret = point.proceed();
Signature signature = point.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method targetMethod = methodSignature.getMethod();
System.out.println("classname:" + targetMethod.getDeclaringClass().getName());
System.out.println("superclass:" + targetMethod.getDeclaringClass().getSuperclass().getName());
System.out.println("isinterface:" + targetMethod.getDeclaringClass().isInterface());
System.out.println("target:" + point.getTarget().getClass().getName());
System.out.println("proxy:" + point.getThis().getClass().getName());
System.out.println("method:" + targetMethod.getName());
System.out.println("methodReturnType:" + targetMethod.getReturnType().getName());
System.out.println("return value:" + ret.getClass().getName());
return ret;
}
我希望ret.getClass()。getName()是列表,但返回值是控制器中的Page