应用具有相同顺序的 Spring 个方面的顺序

Apply Order of Spring Aspects with Same Order

假设有多个方面在应用中,应用在某个方法上。注解@orderOrdered接口可以指定它们的优先级。

但是如果@Order的值相同,如何确定应用顺序?

When two pieces of advice defined in different aspects both need to run at the same join point, unless you specify otherwise the order of execution is undefined. You can control the order of execution by specifying precedence. This is done in the normal Spring way by either implementing the org.springframework.core.Ordered interface in the aspect class or annotating it with the Order annotation. Given two aspects, the aspect returning the lower value from Ordered.getValue() (or the annotation value) has the higher precedence.

无法控制,参考文档6.2.4.7