Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何修复';使用SpringAOP,我想更改返回值,但返回类不是我的方法return';_Java_Spring_Aop - Fatal编程技术网

Java 如何修复';使用SpringAOP,我想更改返回值,但返回类不是我的方法return';

Java 如何修复';使用SpringAOP,我想更改返回值,但返回类不是我的方法return';,java,spring,aop,Java,Spring,Aop,我正在使用Spring AOP更改返回值。但是我发现@Around函数返回值中的不是方法返回值。如何解决此问题 控制器 Page<Object> page = PageHelper.startPage(pageNo, pageSize, true); CallRecordEntity callRecordParam = new CallRecordEntity(); BeanUtils.copyProperties(callRecordVO, callRecordP

我正在使用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);

我希望ret.getClass().getName()是List,但返回值是控制器中的Page,这根本不可能,并且您正在查看的调试不属于您在此处显示的代码。当我删除Page Page=PageHelper.startPage(pageNo,pageSize,true);答案是正确的。这个问题很难理解,题目完全不可理解。请更新问题,以更详细地解释问题是什么?理想情况下,提供一个。到目前为止,我看不到您如何以及在何处更改方面的返回值(您只返回原始值),没有再现问题的应用程序代码,您也没有显示任何解释问题的日志输出。这根本不可能,而且您正在查看的调试不属于您在此处显示的代码。当我删除Page Page=PageHelper.startPage(pageNo,pageSize,true)时;答案是正确的。这个问题很难理解,题目完全不可理解。请更新问题,以更详细地解释问题是什么?理想情况下,提供一个。到目前为止,我看不到如何以及在何处更改方面的返回值(只返回原始值),没有再现问题的应用程序代码,也没有显示解释问题的任何日志输出。
  @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;
  }