The managed bean is a type of Java bean. It is used specifically in JMX technology and it is created using the dependency injection (DI) technique. In JMX, a resource is represented as a managed bean (MBean). These managed beans are registered with a core managed beans server. So, a managed bean can be visualized as a wrapper around Java services, components, or devices. As all the managed components are registered with the MBeans server, it is used for managing all of the managed beans. The managed beans server allows server components to wire in and find managed beans. A typical JMX agent consists of a managed beans server and services required to interact with managed beans.
The JMX specification describes standard connectors. These connectors are also known as JMX connectors. JMX connectors allow us to access JMX agents from remote management applications. The connectors can use different protocols to work with the same management interface.
The following are the reasons why JMX should be used:
It provides a way to manage applications on different devices
It provides a standard way to manage Java applications and networks
It can be used to manage JVM
It provides a scalable and dynamic management interface
With the basic understanding of JMX, let's move on to check how it is supported in Spring. The JMX support for Spring enables us to transform the spring application into JMX architecture quite easily.
The following are the features provided by Spring's JMX support:
Automatic registration of a Spring bean as a managed bean
A flexible structure for controlling the management interface for Spring beans
A declarative approach for managed beans over remote connectors
Proxying of local and remote managed bean resources