1、查看spring所管理的所有的bean名称
vmtool --action getInstances --className org.springframework.context.ApplicationContext --express 'instances[0].getBeanDefinitionNames()'

2、查看具体的某个bean及其属性
vmtool --action getInstances --className org.springframework.context.ApplicationContext --express 'instances[0].getBean("userController")' -x 3

3、调用bean的方法
vmtool --action getInstances --className org.springframework.context.ApplicationContext --express 'instances[0].getBean("userController").findUserById(1)'

参考
本文介绍了如何使用vmtool工具查看Spring管理的所有bean名称、获取特定bean及其属性,以及调用bean的方法。通过示例命令,你可以深入理解Spring bean的管理和操作。
992





