This chapter focuses on techniques for monitoring the performance and health of Spring-based Java EE (JEE) applications. It highlights the importance of understanding runtime behavior to identify potential performance issues such as inefficient Java code, memory leaks, and improper configurations. The chapter covers:

  • Spring’s JMX Support: Demonstrates how to expose Spring beans for monitoring using JMX tools like VisualVM.

  • Monitoring Hibernate Statistics: Explains enabling JMX monitoring for components like Hibernate within Spring-powered applications.

  • Spring Boot JMX Support: Discusses the Spring Boot Actuator, a library that provides JMX support out of the box to expose operational information such as health metrics and application status.

The chapter assumes a basic understanding of JMX and directs readers to Oracle’s resources for more information.

Monitoring Applications with Spring Boot Actuator

Spring Boot enhances application monitoring through JMX when the spring-boot-actuator.jar is included in the classpath. The spring-boot-actuator module offers various production-ready features, which can be activated by adding spring-boot-starter-actuator to the classpath. The dependencies for the chapter18-boot project illustrate this setup, with the spring-boot-starter-actuator showing its transitive dependencies. An actuator, as defined by Spring documentation, is a device that controls or moves something, translating small changes into significant actions.