@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 { ... }
若是不指定优先级,或者优先级被指定为相同,通知执行的优先级都是不定的。