日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達者為師

網(wǎng)站首頁 編程語言 正文

arthas操作spring被代理目標(biāo)對象命令速查

作者:大魚天 更新時間: 2024-07-15 編程語言

一、操作spring bean對象方法

首先,通過sc命令獲取bean類的類加載器hash值,命令如下:

sc -d com.xxx.xxx.web.controller.IndexController

會得到,classLoaderHash ? 69c112b6,然后執(zhí)行獲取到的spring被代理的目標(biāo)對象的方法

ognl -x 3 '#springContext=@com.xxx.xxx.service.util.BeanUtil@applicationContext,#springContext.getBean("indexController").health()' -c 69c112b6

如果沒有beanUtils工具類,還可以通過vmtool命令

vmtool -x 3 --action getInstances --className com.xxx.xxx.web.controller.IndexController --express 'instances[0].health()' -c 69c112b6

二、操作方法重新消費消息

1.通過ognl重新消費消息

?獲取類加載器hash值,同上

ognl -x 3 '#springContext=@com.xxx.xxx.service.util.BeanUtil@applicationContext,#springContext.getBean("storeVenderConsumerHandler").onMessage(new com.xxx.xxx.sdk4.kafka.message.KafkaMsgExt("123","{\"id\":107492,\"level\":\"store\",\"type\":\"update\",\"updateType\":\"base\"}"),null)'  -c 69c112b6

2.通過vmtool重新消費消息

?獲取類加載器hash值,同上

vmtool -x 3 --action getInstances --className com.xxx.xxx.web.dafka.client.StoreVenderMessageListener --express 'instances[0].onMessage(new com.xxx.xxx.sdk4.kafka.message.KafkaMsgExt("123","{\"id\":107492,\"level\":\"store\",\"type\":\"update\",\"updateType\":\"base\"}"),null)' -c 69c112b6

附:beanUtils工具類

@Component
public class BeanUtil implements ApplicationContextAware {

	private static ApplicationContext applicationContext;

	
	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		BeanUtil.applicationContext = applicationContext;
	}

	public static <T> T getBean(String beanName, Class<T> requiredType) {
		return applicationContext.getBean(beanName, requiredType);
	}

}

原文鏈接:https://blog.csdn.net/kfeng632/article/details/126959717

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新