greenbean
Feb 19th, 2006, 01:12 PM
I setup the java 5 annotations to expose my mbean. I also set the persist values. However, I don't see persistence occuring. I do see the bean exposed. I am using Jboss 4.0.3SP1 with Spring 1.2.6.
Should this work? I tried the JBoss method of using a jboss service mbean and it works, however, I would like to avoid the configurations and just use annotations from spring if possible.
@ManagedResource(objectName = "jmx:bean=TestBean",
description = "Test bean",
log = true,
logFile = "jmx.log",
currencyTimeLimit = 0,
persistPolicy = "OnUpdate",
persistName = "testBean")
@ManagedAttribute(description = "Get the value",
currencyTimeLimit = 0,
defaultValue = "test",
persistPolicy = "OnUpdate")
public String getValue() {
return value;
}
@ManagedAttribute(description = "Set the value",
currencyTimeLimit = 0,
defaultValue = "test",
persistPolicy = "OnUpdate")
public void setValue(String value) {
this.value = value;
}
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="assembler" ref="assembler" />
<property name="autodetect" value="true" />
<property name="namingStrategy" ref="namingStrategy"/>
</bean>
<bean id="attributeSource" class="org.springframework.jmx.export.annotation.Annotati onJmxAttributeSource" />
<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNami ngStrategy">
<property name="attributeSource" ref="attributeSource" />
</bean>
<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataM BeanInfoAssembler">
<property name="attributeSource" ref="attributeSource" />
</bean>
Should this work? I tried the JBoss method of using a jboss service mbean and it works, however, I would like to avoid the configurations and just use annotations from spring if possible.
@ManagedResource(objectName = "jmx:bean=TestBean",
description = "Test bean",
log = true,
logFile = "jmx.log",
currencyTimeLimit = 0,
persistPolicy = "OnUpdate",
persistName = "testBean")
@ManagedAttribute(description = "Get the value",
currencyTimeLimit = 0,
defaultValue = "test",
persistPolicy = "OnUpdate")
public String getValue() {
return value;
}
@ManagedAttribute(description = "Set the value",
currencyTimeLimit = 0,
defaultValue = "test",
persistPolicy = "OnUpdate")
public void setValue(String value) {
this.value = value;
}
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="assembler" ref="assembler" />
<property name="autodetect" value="true" />
<property name="namingStrategy" ref="namingStrategy"/>
</bean>
<bean id="attributeSource" class="org.springframework.jmx.export.annotation.Annotati onJmxAttributeSource" />
<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNami ngStrategy">
<property name="attributeSource" ref="attributeSource" />
</bean>
<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataM BeanInfoAssembler">
<property name="attributeSource" ref="attributeSource" />
</bean>