使用AOP的@Around后无返回值的解决
作者:葛旭朋 时间:2023-11-24 13:04:09
经测试,是环绕通知改变了返回值,切面方法需要有返回值,来代替被代理方法返回结果
改成如下即可:
@Around("point_update()")
public Object update(ProceedingJoinPoint jp) throws Throwable{
...
Object result = jp.proceed();
...
return result;
}
让其执行后的结果返回即可。
补充:spring aop @Around 返回参数值为空
在做 spring 项目中用到aop,拦截前端请求后AOP中@Around 处理后返回参数为空。
通过检查接口层Controller方法返回类型为void造成的,返回值改为一致就没问题了。
来源:https://blog.csdn.net/m0_37647376/article/details/103496031
标签:AOP,@Around,返回值
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
spring cloud将spring boot服务注册到Eureka Server上的方法
2023-12-08 19:42:09
![](https://img.aspxhome.com/file/2023/7/60837_0s.png)
Java中方法的使用、重载与递归的详细介绍
2022-03-02 02:50:05
![](https://img.aspxhome.com/file/2023/8/60928_0s.png)
Android中CountDownTimer倒计时器用法实例
2022-08-10 16:59:40
C#自定义针对URL地址的处理类实例
2022-09-12 16:54:02
关于Java中@SuppressWarnings的正确使用方法
2023-07-22 17:17:58
![](https://img.aspxhome.com/file/2023/9/77109_0s.jpg)
C#6 null 条件运算符
2022-03-04 19:42:14
解决Java导入excel大量数据出现内存溢出的问题
2023-05-30 08:41:20
Android 滑动监听的实例详解
2023-10-28 14:32:32
![](https://img.aspxhome.com/file/2023/9/91049_0s.png)
深入理解Android热修复技术原理之so库热修复技术
2023-11-19 15:02:10
![](https://img.aspxhome.com/file/2023/8/137178_0s.jpg)
2020年IntelliJ IDEA最新最详细配置图文教程详解
2022-08-19 00:07:51
Android 三级NestedScroll嵌套滚动实践
2022-11-12 07:45:21
![](https://img.aspxhome.com/file/2023/3/138943_0s.png)
Java实现在Word指定位置插入分页符
2021-06-29 03:24:44
![](https://img.aspxhome.com/file/2023/1/75451_0s.png)
Java中保证线程顺序执行的操作代码
2023-05-14 17:36:46
C#多态详解
2023-06-25 13:42:20
![](https://img.aspxhome.com/file/2023/1/78191_0s.png)
MyBatis在注解上使用动态SQL方式(@select使用if)
2023-09-24 06:52:55
Android实现简易秒表功能
2021-08-29 11:06:58
![](https://img.aspxhome.com/file/2023/6/95986_0s.jpg)
详解commons-pool2池化技术
2021-09-10 10:56:29
![](https://img.aspxhome.com/file/2023/9/64899_0s.jpg)
详解在Spring中如何使用AspectJ来实现AOP
2021-10-23 02:06:06
Unity实现简单虚拟摇杆
2023-08-04 17:33:09
![](https://img.aspxhome.com/file/2023/5/84425_0s.jpg)
细说C#中的枚举:转换、标志和属性
2021-07-10 06:01:05