每一个切面都有一个默认的优先级(默认值为Integer的最大值)
@Order(1)通过这个注解设置一个正整数数值,数值越小,优先级越高
@Component
@Aspect//将当前组件标识为切面
@Order(1)
public class ValidateAspect {
//@Before("execution(* com.javasm.spring.aop.annotation.CalculatorImpl.*(..))")
@Before("com.javasm.spring.aop.annotation.LoggerAspect.pointCut()")
public void beforMethod(){
System.out.println("ValidateAspect-->前置通知");
}
}
Original: https://www.cnblogs.com/bieyinan/p/16697176.html
Author: 别亦难
Title: Spring基于注解的AOP的切面优先级
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/684950/
转载文章受原作者版权保护。转载请注明原作者出处!