1. 单元测试方法新增代码,阻止程序终止
System.in.read();
2. 启动Arthas
选择项目 com.intellij.rt.junit.JUnitStarter 代表是单元测试进程
3. 查询指定类的增强类
sc *ControllerName*
输出
com.controller.ControllerName
com.controller.ControllerName$$EnhancerBySpringCGLIB$$1
com.controller.ControllerName$$EnhancerBySpringCGLIB$$1$$FastClassBySpringCGLIB$$2
com.controller.ControllerName$$FastClassBySpringCGLIB$$3
4. 代码输出到文件中
jad com.controller.</

本文介绍了如何在单元测试中利用Arthas来查看动态代理的增强类。通过在单元测试方法中增加特定代码防止程序终止,然后启动Arthas并连接到单元测试进程。接着,查询并输出了指定类的增强类信息,这些信息被进一步导出到文件中,便于详细分析增强类的源码。
最低0.47元/天 解锁文章
1138

被折叠的 条评论
为什么被折叠?



