2013-02-21 148 views
6

我創建了一些實現接口的bean,並創建了一個自定義的MBean導出器,將這些bean公開到jconsole。 雖然一切工作正常,說明未正確顯示。 在bean的頂部我看到:如何顯示jmx MBean的類描述,屬性描述和操作描述

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

,並在屬性的描述,我看到的操作:

Operation exposed for management

有沒有辦法看到我在@ManagedResource設置的說明註釋?提前

回答

0

你需要一個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> 
0

有請您儘量提供對象的名稱和說明?

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