Spring AOP: How to determine if method threw an exception using @After?

拈花ヽ惹草 提交于 2019-12-02 10:56:10

What the documentation wants to say is that your @After advice should do a valid thing no matter whether an exception was thrown or not. It does not mean you can determine it from the advice. If different things should be done,

  • either use @AfterReturning vs. @AfterThrowing if the control flow is not to be touched and no exception is to be handled by your advices,
  • or use an @Around advice if you want to actually catch and handle thrown exceptions and/or modify method parameters before call or the return value after the call or skip method execution altogether.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!