@Aspect public class CalculatorValidationAspect implements Ordered { @Before("execution(* *.*(double, double))") public void validateBefore(JoinPoint joinPoint) { ... ... } public int getOrder() { return 0; } }
@Aspect public class CalculatorLoggingAspect implements Ordered { ... .. public int getOrder() { return 1; } }
@Aspect @Order(0) public class CalculatorValidationAspect { ... }
@Aspect @Order(1) public class CalculatorLoggingAspect { ... }
若是不指定優先級,或者優先級被指定爲相同,通知執行的優先級都是不定的。