# aop **Repository Path**: The-Keyboard/aop ## Basic Information - **Project Name**: aop - **Description**: 国产最强java aop - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 17 - **Forks**: 9 - **Created**: 2024-12-13 - **Last Updated**: 2025-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 愿景 好用的aop 1 万物皆可切. 2 api极简. 3 高性能. 4 任何时间皆可切 # 为什么有spring aop 等强大的aop,还要开发eazy aop 1,spring aop有很多失效的场景,对团队里新人开发不友好,容易导致线上故障 2,spring aop 只能针对spring bean进行植入,非spring bean不支持植入 # vs Spring Aop 支持static方法,支持final方法,支持private方法,支持this调用,无失效场景 性能远高于spring aop # vs aspectJ 可在运行时,进行植入。非局限于class加载时,可在class被加载后,依然支持植入。支持在任何时候对类进行切面植入 # -- 使用文档 ## 1, 集成 ```xml io.gitee.the-keyboard.aop aop- 1.0.0 ``` 通过网页获取最新版本 https://repo.maven.apache.org/maven2/io/gitee/the-keyboard/aop/aop-/ ## 2, 定义around类 ```java import com.easyaop.api.around.Around; import com.easyaop.api.around.Call; import com.easyaop.api.join.JoinPoint; public class MyAround implements Around { public Object around(Object target, Object[] args, JoinPoint joinPoint, Call call) throws Exception { System.out.println("around before "); return call.call(); } } ``` around增强编写注意事项 a, 在around方法内,不能使用this访问实例 因为around方法所有的汇编指令,最终会被插入目标方法,并不存在around对象 b, 在around方法内, 如果要访问静态方法a()或者静态属性b,则要注意访问权限. 因为around方法所有的汇编指令,最终会被插入目标方法, 要考虑目标对象是不是有访问a() 或者b的权限 ## 3, api ```java Pointcut pointcut = MethodPointcut.of("类名","方法名","(..)"); AroundsImpl.getInstance().add( pointcut, new MyAround()); ``` ## 4, 日志位置 ~/logs/weaving.log 修改后的class ,放在dump/ ## 变更 1.0.? 注解切点的bug