如何显示jmx MBean的类描述,属性描述和操作描述
问题描述:
我创建了一些实现接口的bean,并创建了一个自定义的MBean
导出器,将这些bean公开到jconsole
。 虽然一切工作正常,说明未正确显示。 在bean的顶部我看到:如何显示jmx MBean的类描述,属性描述和操作描述
Java Class : $Proxy483 Description : Information on the management interface of the MBean
,并在属性的描述,我看到的操作:
Operation exposed for management
有没有办法看到我在@ManagedResource
设置的说明注释?提前
答
你需要一个JmxAttributeSource实现你的MBeanExporter
感谢(没有默认值)。春天reference提供了以下例子:
<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."
)