Spring Annotations @ Managed *에서 설명 정보를 얻는 방법은 MBean이나 MXBean이 아닌 표준 Spring "관리 Bean"을 선언하는 것입니다.
이렇게하려면 예제에서 "MBean"접미사로 인터페이스를 구현하면 안됩니다. 그런 다음 빈은 MBeanExporter가 BeanInstance (..)를 등록 할 때 표준 "관리 빈"으로 감지되며 속성, 작업, 매개 변수 등의 설명을 포함하여 모든 스프링 주석을 사용하여 ModelMBean으로 변환됩니다.
요구 사항으로
, 당신은 다음과 같이 간단하게 할 수 AnnotationJmxAttributeSource, MetadataNamingStrategy를 및 MetadataMBeanInfoAssembler가 속성으로 MBeanExporter에 당신의 봄 컨텍스트에서 선언해야합니다 :
<bean id="mbeanExporter"
class="org.springframework.jmx.export.annotation.AnnotationMBeanExporter" />
또는
<context:mbean-export />
(롤랜드에 의해 설명)그리고 당신의 관리 빈은 다음과 같아야합니다
@Component("myManagedBean")
@ManagedResource(objectName="your.domain.jmx:name=MyMBean",
description="My MBean goal")
public class AnnotationTestBean {
private int age;
@ManagedAttribute(description="The age attribute", currencyTimeLimit=15)
public int getAge() {
return age;
}
@ManagedOperation(description = "Check permissions for the given activity")
@ManagedOperationParameters({
@ManagedOperationParameter(name = "activity",
description = "The activity to check")
})
public boolean isAllowedTo(final String activity) {
// impl
}
}
것은의 StandardMBean 것 MBean의 인터페이스를 구현하지 기억!
Java 문서에서 MBeanInfo를 사용할 수 있음을 이해했지만 예제와 정의가 충분하지 않습니다. http://download.oracle.com/javase/1.5.0/docs/api/javax/management /MBeanInfo.html – Raman