简体   繁体   English

如何显示jmx MBean的类描述,属性描述和操作说明

[英]How to Show Class Description, Attribute descriptions and Operation Descriptions of jmx MBeans

I have created some beans that implement an interface and created a custom MBean exporter to expose those beans to jconsole . 我创建了一些实现接口的bean,并创建了一个自定义MBean导出器来将这些bean公开给jconsole Although everything works fine, the descriptions are not shown correctly. 虽然一切正常,但描述没有正确显示。 At the top of the bean I see: 在bean的顶部,我看到:

Java Class :   $Proxy483
Description :   Information on the management interface of the MBean

and at the descriptions of the attributes and the operations I see: 在我看到的属性和操作的描述中:

Operation exposed for management

Is there any way to see the descriptions I have set in @ManagedResource annotations? 有没有办法看到我在@ManagedResource注释中设置的描述?

Thanks in advance 提前致谢

You'll need a JmxAttributeSource implementation for your MBeanExporter (there is no default). 你需要为MBeanExporter实现一个JmxAttributeSource实现(没有默认值)。 Spring reference provides the following example: 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>

Have you try to provide object name and description? 您是否尝试提供对象名称和描述?

@ManagedResource(
    objectName="org.springbyexample.jmx:name=ServerManager", 
    description="Server manager."
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM