Gary Russels's Monitoring Spring Integration application is great.
I would like to add simple MBean to monitor the application. Here is my code:
package com.example;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.stereotype.Component;
@Component
@ManagedResource(objectName="myapp:application=hello")
public class HelloBean {
@ManagedOperation
public String sayHello(String name) {
return "Hello " + name;
}
}
I also added the following in spring-context xml file:
<context:mbean-server />
<int-jmx:mbean-export id="integrationMBeanExporter" default-domain="spring.application" />
<bean id="helloBean" class="com.example.HelloBean" />
when I look in jVisualVM, I do not see the bean. I can see MessageChannel in spring.application domain but not my MBean.
is there any thing else to be done to get annotated MBeans to show in visualVM?
Thanks.
<context:mbean-export/>
is for you.
The <int-jmx:mbean-export>
is a custom MBeanExporter
for Spring Integration components. Everything else should be managed by the standard Spring <context:mbean-export/>
.