51. Monitoring and Management over JMX

Java Management Extensions (JMX) provide a standard mechanism to monitor and manage applications. By default, Spring Boot exposes management endpoints as JMX MBeans under the org.springframework.boot domain.

51.1 Customizing MBean Names

The name of the MBean is usually generated from the id of the endpoint. For example the health endpoint is exposed as org.springframework.boot:type=Endpoint,name=Health.

If your application contains more than one Spring ApplicationContext, you may find that names clash. To solve this problem, you can set the management.endpoints.jmx.unique-names property to true so that MBean names are always unique.

You can also customize the JMX domain under which endpoints are exposed. The following settings show an example of doing so in application.properties:

management.endpoints.jmx.domain=com.example.myapp
management.endpoints.jmx.unique-names=true

51.2 Disabling JMX Endpoints

If you do not want to expose endpoints over JMX, you can set the endpoints.default.jmx.enabled property to false, as shown in the following example:

endpoints.default.jmx.enabled=false

51.3 Using Jolokia for JMX over HTTP

Jolokia is a JMX-HTTP bridge that provides an alternative method of accessing JMX beans. To use Jolokia, include a dependency to org.jolokia:jolokia-core. For example, with Maven, you would add the following dependency:

<dependency>
	<groupId>org.jolokia</groupId>
	<artifactId>jolokia-core</artifactId>
	</dependency>

Jolokia can then be accessed by using /application/jolokia on your management HTTP server.

51.3.1 Customizing Jolokia

Jolokia has a number of settings that you would traditionally configure using servlet parameters. With Spring Boot, you can use your application.properties. Prefix the parameter with management.jolokia.config., as shown in the following example:

management.jolokia.config.debug=true

51.3.2 Disabling Jolokia

If you use Jolokia but do not want Spring Boot to configure it, set the management.jolokia.enabled property to false, as follows:

management.jolokia.enabled=false