2013-02-21 41 views
6

Tôi đã tạo một số bean thực hiện giao diện và tạo một nhà xuất khẩu tùy chỉnh MBean để lộ những hạt đó thành jconsole. Mặc dù mọi thứ hoạt động tốt, các mô tả không được hiển thị chính xác. Ở phía trên cùng của bean tôi thấy:Cách hiển thị mô tả lớp học, mô tả thuộc tính và mô tả hoạt động của jmx MBeans

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

đồng giới thiệu các thuộc tính và các hoạt động tôi thấy:

Operation exposed for management

Có cách nào để xem giới thiệu tôi đã thiết lập trong @ManagedResource chú thích?

Cảm ơn trước

Trả lời

0

Bạn sẽ cần một việc thực hiện JmxAttributeSource cho MBeanExporter của bạn (không có mặc định). Spring reference cung cấp ví dụ sau:

<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

Bạn đã cố gắng cung cấp tên và mô tả đối tượng chưa?

@ManagedResource(
    objectName="org.springbyexample.jmx:name=ServerManager", 
    description="Server manager." 
) 
Các vấn đề liên quan