![](/img/trans.png)
[英]Why does JBoss JMX console not show descriptions of Spring-defined MBeans?
[英]How to Show Class Description, Attribute descriptions and Operation Descriptions of jmx MBeans
我创建了一些实现接口的bean,并创建了一个自定义MBean
导出器来将这些bean公开给jconsole
。 虽然一切正常,但描述没有正确显示。 在bean的顶部,我看到:
Java Class : $Proxy483 Description : Information on the management interface of the MBean
在我看到的属性和操作的描述中:
Operation exposed for management
有没有办法看到我在@ManagedResource
注释中设置的描述?
提前致谢
你需要为MBeanExporter实现一个JmxAttributeSource实现(没有默认值)。 Spring 引用提供了以下示例:
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="assembler" ref="assembler"/>
<property name="namingStrategy" ref="namingStrategy"/>
<property name="autodetect" value="true"/>
</bean>
<!-- Implementation of the JmxAttributeSource interface that reads JDK 1.5+ annotations and exposes the corresponding attributes -->
<bean id="jmxAttributeSource" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource"/>
<!-- will create management interface using annotation metadata -->
<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
<property name="attributeSource" ref="jmxAttributeSource"/>
</bean>
<!-- will pick up the ObjectName from the annotation -->
<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
<property name="attributeSource" ref="jmxAttributeSource"/>
</bean>
您是否尝试提供对象名称和描述?
@ManagedResource(
objectName="org.springbyexample.jmx:name=ServerManager",
description="Server manager."
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.