簡體   English   中英

如何顯示jmx MBean的類描述,屬性描述和操作說明

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM