首页  

Spring JMX     所属分类 jmx 浏览量 1196
四种类型的MBean

Standard MBean
Dynamic MBean
Open MBean
Model MBean

A standard MBean is defined by writing a Java interface called SomethingMBean 
and a Java class called Something that implements that interface.

接口 xxxMBean   实现类 xxx



Spring JMX

@ManagedResource 在类上使用,把类标记为MBean
@ManagedOperation 在可操作的方法上使用
@ManagedAttribute 如果属性可读写,在getter和setter上使用,只读 只在getter上使用


import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.stereotype.Component;

@Component
@ManagedResource(objectName="springboothello:name=jmxhello",description="jmx hello bean")
public class JmxHelloBean {
	private String msg = "hello";
	
	@ManagedAttribute
	public String getMsg() {
		return msg;
	}

	@ManagedOperation
	public void setMsg(String msg) {
		this.msg = msg;
	}	
}


使用 jvisualvm 连接 jvm 进程 ,获取 jmx 信息

上一篇     下一篇
互联网广告术语解释

linux sort 命令

Java黑科技VirtualMachine

JVM Attach机制

arthas原理简介

OLAP引擎介绍及比较