====== 区别 ====== - aspectj 是在编译时直接对类增强。与spring无关 - spring-aop 在运行时生成拦截类的子类(子类中加入增强逻辑) ====== aspectj ====== {{:pasted:20221215-063811.png}} {{:pasted:20221215-063834.png}} {{:pasted:20221215-064017.png}} ====== spring-aop====== === 用法1:注解 (借鉴aspectj 注解的简单性 ) === aspectj注解的方式太好用了,spring 兼容了aspectj的注解语法,底层实现还是通过glibc生成增强子类 {{:pasted:20221215-064315.png}} === 用法2:接口 === {{:pasted:20221215-064509.png}} 运行时能看到确实是生成了一个增强子类 {{:pasted:20221215-064812.png}}