加里·拉塞尔的监测弹簧集成应用程序很棒。
我想添加简单的MBean来监视应用程序。这是我的代码:
package com.example;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.stereotype.Component;
@Component
@ManagedResource(objectName="myapp:application=hello")
public class HelloBean {
@ManagedOperation
public String sayHello(String name) {
return "Hello " + name;
}
}我还在spring上下文xml文件中添加了以下内容:
<context:mbean-server />
<int-jmx:mbean-export id="integrationMBeanExporter" default-domain="spring.application" />
<bean id="helloBean" class="com.example.HelloBean" />当我看jVisualVM时,我没有看到豆子。我可以在MessageChannel域中看到spring.application,但看不到我的MBean。

为了让带注释的MBeans在visualVM中显示,还有什么事情要做吗?
谢谢。
发布于 2016-06-09 19:22:16
<context:mbean-export/>是给你的。
<int-jmx:mbean-export>是Spring组件的自定义MBeanExporter。其他一切都应该由标准的Spring<context:mbean-export/>来管理。
https://stackoverflow.com/questions/37734269
复制相似问题