img
Figure 23-3. The sample web application
To reiterate, the sample application is the same as the web application developed in Chapter 17. In
addition, a batch job was implemented that will poll the folder C:\temp\contact\contacts.xml for
contact information in XML format for batch upload.
JMX Support in Spring
In JMX, the classes that are exposed for JMX monitoring and management are called managed beans
(generally referred to as MBeans). The Spring Framework supports several mechanisms for exposing
MBeans. In this chapter, we will focus on exposing Spring beans (which were developed as simple
POJOs) as MBeans for JMX monitoring.
In the following sections, we will discuss the procedure for exposing a bean containing application-
related statistics as an MBean for JMX monitoring. Topics include implementing the Spring bean,
exposing the Spring bean as an MBean in Spring ApplicationContext, and using VisualVM to monitor
the MBean. In addition, we will also discuss how some metrics relating to Spring Security can be
exposed to JMX.
Exporting a Spring Bean to JMX
As an example, for the sample web application, which maintains a list of contact information, we would
like to expose the count of the contacts in the database for JMX monitoring purposes. So, let's
implement the interface and the class, which are shown in Listings 23-1 and 23-2, respectively.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home