I have created some beans that implement an interface and created a custom MBean
exporter to expose those beans to jconsole
. Although everything works fine, the descriptions are not shown correctly. At the top of the bean I see:
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?
Thanks in advance
You'll need a JmxAttributeSource implementation for your MBeanExporter (there is no default). Spring reference provides the following example:
<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."
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.