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 quite 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 please add the Jolokia JMX library to our compile("org.jolokia:jolokia-core:+")
build dependency as we will need it to expose MBeans via HTTP.
How to do it…
After we add the Jolokia JMX dependency, all we need to do...