Search code examples
exceptionreturnaspectjpointcut

Getting a return value or exception from 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.


Solution

  • 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).