Chapter 18. Monitoring Spring with JMX

 

This chapter covers

  • Working with Actuator endpoint MBeans
  • Exposing Spring beans as MBeans
  • Publishing notifications

For over a decade and a half, Java Management Extensions (JMX) has been the standard means of monitoring and managing Java applications. By exposing managed components known as MBeans (managed beans), an external JMX client can manage an application by invoking operations, inspecting properties, and monitoring events from MBeans.

JMX is automatically enabled by default in a Spring Boot application. As a result, all of the Actuator endpoints are exposed as MBeans. And it sets us up nicely to expose any other bean in the Spring application context as an MBean. We’ll start exploring Spring and JMX by looking at how Actuator endpoints are exposed as MBeans.

18.1. Working with Actuator MBeans

Take a look back at table 16.1. All of the Actuator endpoints listed there, except for /heapdump, are exposed as MBeans. You can use any JMX client you wish to connect with Actuator endpoint MBeans. Using JConsole, which comes with the Java Development Kit, you’ll find Actuator MBeans listed under the org.springframework.boot domain, as shown in figure 18.1.

Figure 18.1. Actuator endpoints are automatically exposed as JMX MBeans.

18.2. Creating your own MBeans

18.3. Sending notifications

Summary

sitemap