type
status
date
slug
summary
tags
category
password
1、使用vmtool命令
--action getInstances
:将获取的对象注入变量 instances 中,instances是一个数组
--limit 10
: 一次只输出10个,减小服务器压力
-c 19469ea2
: 指定类加载器的 hashCode,可以通过sc -d [classFullName]
获取类加载器的 hashCode
-x
: 指定结果的展开层次,默认为1
--express
: 参数执行指定的表达式。
示例:
1、查看 spring 所管理的所有的 bean 名称
2、查看具体的某个 bean 及其属性
3、调用 bean 的方法
4、获取静态对象
5、获取所有实例
2、使用ognl命令
ognl 只能获取静态的类字段和方法。
1、静态属性/静态方法
2、Spring 实例对象。首先项目有一个实现了
ApplicationContextAware
接口的工具类 SpringContextUtil
。查看实例对象/调用实例对象方法
3、使用watch命令
watch 只有在调用的时候才能获取到实例的值。
class-pattern
:类名表达式匹配
method-pattern
:方法名表达式匹配
express
:观察表达式
condition-express
:条件表达式
[b]
:在方法调用之前观察
[e]
:在方法异常之后观察
[s]
:在方法返回之后观察
[f]
:在方法结束之后(正常返回和异常返回)观察
[E]
:开启正则表达式匹配,默认为通配符匹配
[x:]
:指定输出结果的属性遍历深度,默认为 1
[n:]
:监听多少次就结束,默认100次
观察表达式的构成主要由 ognl 表达式组成
示例
- Author:mcbilla
- URL:http://mcbilla.com/article/10985c7d-7c1d-8053-a1f1-cc7ba231170f
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts