从AspectJ获取返回值或异常? [英] Getting a return value or exception from AspectJ?

查看:168
本文介绍了从AspectJ获取返回值或异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从建议的方法调用中获取签名和参数,但是我无法弄清楚如何获取返回值或异常。我有点假设它可以以某种方式使用,并且继续。

I am able to get the signature and arguments from advised method calls, but I cannot figure out how to get the return values or exceptions. I'm kind of assuming that it can be done in some way using around and proceed.

推荐答案

你可以使用 after()返回 after()throwing 建议在以下文档。如果您使用@AspectJ语法,请参阅 @AfterReturning @AfterThrowing 注释(您可以找到样本 here )。

You can use after() returning and after() throwing advices as in beginning of the following document. If you're using @AspectJ syntax please refer to @AfterReturning and @AfterThrowing annotations (you can find samples here).

这篇关于从AspectJ获取返回值或异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆