Class JmxBean
java.lang.Object
com.j256.simplejmx.spring.JmxBean
With this bean, which is auto-detect by the
BeanPublisher, you can configure in Spring a JMX bean for an
object that does not use the JmxResource annotation or JmxSelfNaming interface.
For example:
<!-- some random bean defined in your spring files -->
<bean id="someBean" class="your.domain.SomeBean">
...
</bean>
<!-- publish information about that bean via JMX -->
<bean id="someBeanJmx" class="com.j256.simplejmx.spring.JmxBean">
<!-- helps build the ObjectName -->
<property name="jmxResourceInfo">
<bean class="com.j256.simplejmx.common.JmxResourceInfo">
<property name="jmxDomainName" value="your.domain" />
<property name="jmxBeanName" value="SomeBean" />
</bean>
</property>
<!-- defines the fields that are exposed for JMX -->
<property name="attributeFieldInfos">
<array>
<bean class="com.j256.simplejmx.common.JmxAttributeFieldInfo">
<property name="name" value="someCounter" />
</bean>
</array>
</property>
<!-- defines the get/is/set methods exposed -->
<property name="attributeMethodInfos">
<array>
<bean class="com.j256.simplejmx.common.JmxAttributeMethodInfo">
<property name="methodName" value="getSomeValue" />
</bean>
</array>
</property>
<!-- defines the operations (i.e. non get/is/set) methods exposed -->
<property name="operationInfos">
<array>
<bean class="com.j256.simplejmx.common.JmxOperationInfo">
<property name="methodName" value="someMethod" />
</bean>
</array>
</property>
<property name="target" ref="someBean" />
</bean>
You can also use setAttributeFieldNames(String), setAttributeMethodNames(String), and
setOperationNames(String) by injecting a comma-separate list of names.
<bean id="jmxServerJmx" class="com.j256.simplejmx.spring.JmxBean"> <property name="jmxResourceInfo"> ... </property> <!-- defines the fields names that are exposed for JMX --> <property name="attributeFieldNames" value="someCounter,someOtherField" /> <property name="attributeMethodNames" value="getSomeValue" /> <property name="operationNames" value="methodName" /> <property name="target" ref="someBean" /> </bean>
- Author:
- graywatson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetAttributeFieldInfos(JmxAttributeFieldInfo[] attributeFieldInfos) Optional setting which defines the fields to be exposed as attribute via JMX.voidsetAttributeFieldNames(String fieldNames) Optional setting which defines a comma separated list of field names.voidsetAttributeMethodInfos(JmxAttributeMethodInfo[] attributeMethodInfos) Optional setting which defines the methods (get/is/set...) to be exposed as attributes via JMX.voidsetAttributeMethodNames(String methodNames) Optional setting which defines a comma separated list of field names.voidsetJmxResourceInfo(JmxResourceInfo jmxResourceInfo) Required resource information which helps to make the ObjectName for the bean that we are exposing via JMX.voidsetOperationInfos(JmxOperationInfo[] operationInfos) Optional setting which defines the additional methods (not get/is/set...) to be exposed as operations via JMX.voidsetOperationNames(String operationNames) Optional setting which defines a comma separated list of field names.voidRequired target object which specifies the Spring bean that we are exposing via JMX.
-
Constructor Details
-
JmxBean
public JmxBean() -
JmxBean
-
-
Method Details
-
getJmxResourceInfo
-
setJmxResourceInfo
Required resource information which helps to make the ObjectName for the bean that we are exposing via JMX. -
getAttributeFieldInfos
-
setAttributeFieldInfos
Optional setting which defines the fields to be exposed as attribute via JMX. If you just need to list the field names then you should usesetAttributeFieldNames(String). -
setAttributeFieldNames
Optional setting which defines a comma separated list of field names. If you want descriptions then you should usesetAttributeFieldInfos(JmxAttributeFieldInfo[]). -
getAttributeMethodInfos
-
setAttributeMethodInfos
Optional setting which defines the methods (get/is/set...) to be exposed as attributes via JMX. If you just need to list the method names then you should usesetAttributeMethodNames(String). -
setAttributeMethodNames
Optional setting which defines a comma separated list of field names. If you want descriptions then you should usesetAttributeMethodInfos(JmxAttributeMethodInfo[]). -
getOperationInfos
-
setOperationInfos
Optional setting which defines the additional methods (not get/is/set...) to be exposed as operations via JMX. -
setOperationNames
Optional setting which defines a comma separated list of field names. If you want descriptions then you should usesetOperationInfos(JmxOperationInfo[]). -
getTarget
-
setTarget
Required target object which specifies the Spring bean that we are exposing via JMX.
-