Spring integrates jmx. I found some before, which are a bit complicated. I will give you an easy-to-understand one. How to
use Jmx and Java Management Extension
spring配置文件添加
<context:mbean-export default-domain="morning" registration="replaceExisting" />
@Component @ManagedResource(objectName = "morning:name=Test", description = "描述") public class TestMBean { private boolean test= true; @ManagedAttribute(description = "Method description" ) public boolean isTest() { return addAdmin; } }