环绕通知相关问题

来源:5-5 Advice应用(下)

梦是无声的醒

2018-07-03 22:31

这次after为何在after returning之前执行了呢

写回答 关注

1回答

  • 精慕门1546425
    2018-07-20 10:48:19
    已采纳

    Spring官方的说法是,在同一个切面内,同类型(前/后)的通知顺序是不确定的。因为通过反射确定类中生命(这句话的意思,我也不理解)。

    见官方文档说明(同时给出了排序的建议):

    When two pieces of advice defined in the same aspect both need to run at the same join point, the ordering is undefined (since there is no way to retrieve the declaration order via reflection for javac-compiled classes). Consider collapsing such advice methods into one advice method per join point in each aspect class, or refactor the pieces of advice into separate aspect classes - which can be ordered at the aspect level.

    精慕门154...

    确定类中生命=确定类中声明顺序

    2018-07-20 10:49:11

    共 1 条回复 >

Spring入门篇

为您带来IOC和AOP的基本概念及用法,为后续高级课程学习打下基础

268785 学习 · 963 问题

查看课程

相似问题