Byteman是干嘛的
Byteman 是一个Java字节码注入工具,用以简化 Java 应用程序的测试和开发,使用名为 fault injection 的技术。通过在应用代码中注入脚本来对应用进行测试。
我是怎么接触Byteman的
我比较关注zookeeper社区,zookeeper社区里有个issue,需要用到字节码注入工具,我对这个issue很兴趣,复现的时候就使用了byteman
issue地址:
开始学习
安装
两种方式:
- 官网下载程序
- brew安装
brew install byteman
使用
BMUnit
参考文档:https://developer.jboss.org/docs/DOC-52953#top
项目地址:https://github.com/lanicc/learn-byteman
怎样注入一个已经运行的程序
参考文档:https://developer.jboss.org/docs/DOC-17213#how_do_i_install_the_agent_into_a_running_program