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.
2018-07-20
Spring官方的說法是,在同一個(gè)切面內(nèi),同類型(前/后)的通知順序是不確定的。因?yàn)橥ㄟ^反射確定類中生命(這句話的意思,我也不理解)。
見官方文檔說明(同時(shí)給出了排序的建議):
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.