O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exporting an MBean in a Spring context

Now, we need to create an MBeanExporter in a Spring application context. We just need to add the following tag in the Spring context XML configuration:

<context:mbean-export/>
We need to add the component-scan element before the ‹context:mbean-export/› element; otherwise, the JMX server will not be able to find any beans.

So, our Spring context configuration will look like the following:

<?xml version="1.0" encoding="UTF-8"?><beans><!-- Skipped schema definitions -->  <context:component-scan base-   package="com.packt.springhighperformance.ch4.mbeans" />   <context:mbean-export/></beans>

Now, we just need to start our Tomcat server and open the JConsole to see our MBean. After connecting to JConsole, go ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required