- 查看运行的代码
jad com.example.ClassName
- 查看对象及属性。
备注:我搜了一下没找到合适方法直接查看对象的成员变量,自己发现了这样一个办法,一般我们用Spring时,可以写一个Holder类,实现ApplicationContextAware接口,这样我们在Spring加载后可以获取其context变量,context.getBean可以通过类名获取对象。所以可以这样写:
ognl '@com.xxx.itc.quartz.utils.SpringApplicationContextHolder@getSpringBean("insurancePolicyUseCountController").detailSize'
我想查看的类是这样的:
@Controller
class InsurancePolicyUseCountController {
private int detailSize;
}
结果如下: 类型Integer 值为0
[arthas@57043]$ ognl '@com.xxx.itc.quartz.utils.SpringApplicationContextHolder@getSpringBean("insurancePolicyUseCountController").detailSize'
@Integer[0]
[arthas@57043]$
- 查看类的静态成员
getstatic cn.lw.ClassName propName
- 查看方法
jad cn.lw.ClassName toString
2021-01-22年补充:
用MAT查看成员变量,更通用