Monitoring Spring Boot via JMX
In today's day and age, the RESTful HTTP JSON services are a de facto way of accessing data, but this is not the only way to do so. Another fairly popular and common way of managing systems in real time is via JMX. The good news is that Spring Boot already comes with the same level of support to expose the management endpoints over JMX as it does over HTTP. Actually, these are exactly the same endpoints; they are just wrapped around the MBean container.
In this recipe, we will take a look at how to retrieve the same information via JMX as we did via HTTP as well as how to expose some MBeans, which are provided by third-party libraries through HTTP using the Jolokia JMX library.
Getting ready
If you haven't done so already for the previous recipe, then add the Jolokia JMX library to our compile("org.jolokia:jolokia-core:+")
build dependency and add the management.jolokia.enabled=true
property to application.properties
, as we will need them to expose MBeans via...