Springboot Actuator之九:actuator jmx endpoint
1、配置
endpoints.jmx.domain: myapp
endpoints.jmx.uniqueNames: true
endpoints.auditevents.enabled: true
2、结果:

自定义Bean,通过JMX暴露
package com.dxz.actuator; 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 = "com.dxz.jmx:type=SimpleBean", description = "这里是描述")
public class SimpleBean {
private long id;
private String name;
private int age; /**
* 暴露属性
*/
@ManagedAttribute(description = "这是属性id")
public long getId() {
return id;
} public void setId(long id) {
this.id = id;
} /**
* 暴露属性
*/
@ManagedAttribute(description = "这是属性name")
public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} /**
* 暴露属性
*/
@ManagedAttribute(description = "这是属性age")
public int getAge() {
return age;
} public void setAge(int age) {
this.age = age;
} /**
* 暴露方法
*/
@ManagedOperation(description = "这里是操作")
public String display() {
return this.toString();
} @Override
public String toString() {
return "SimpleBean{" + "id=" + id + ", name='" + name + '\'' + ", age=" + age + '}';
}
}
下面的controller为了测试,改变数据,
package com.dxz.actuator; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; @RestController
public class JmxController {
@Autowired
private SimpleBean simpleBean; @GetMapping("/jmx")
public SimpleBean simpleBean(@RequestParam(required = false) Long id, @RequestParam(required = false) String name,
@RequestParam(required = false) Integer age) {
if (id != null) {
simpleBean.setId(id);
}
if (name != null) {
simpleBean.setName(name);
}
if (age != null) {
simpleBean.setAge(age);
}
return simpleBean;
}
}
结果:


Springboot Actuator之九:actuator jmx endpoint的更多相关文章
- Springboot Actuator之八:actuator的执行原理
本文接着<Springboot Actuator之七:actuator 中原生endpoint源码解析1>,前面主要分析了原生endpoint的作用. 现在着重了解actuator的执行原 ...
- SpringBoot系列(九)单,多文件上传的正确姿势
SpringBoot系列(九)分分钟解决文件上传 往期推荐 SpringBoot系列(一)idea新建Springboot项目 SpringBoot系列(二)入门知识 springBoot系列(三)配 ...
- Springboot Actuator之七:actuator 中原生endpoint源码解析1
看actuator项目的包结构,如下: 本文中的介绍Endpoints. Endpoints(端点)介绍 Endpoints 是 Actuator 的核心部分,它用来监视应用程序及交互,spring- ...
- Springboot监控之一:SpringBoot四大神器之Actuator之3-springBoot的监控和管理--指标说明
Spring Boot包含很多其他的特性,它们可以帮你监控和管理发布到生产环境的应用.你可以选择使用HTTP端点,JMX或远程shell(SSH或Telnet)来管理和监控应用.审计(Auditing ...
- Spring Boot]SpringBoot四大神器之Actuator
论文转载自博客: https://blog.csdn.net/Dreamhai/article/details/81077903 https://bigjar.github.io/2018/08/19 ...
- SpringBoot四大神器之Actuator
介绍 Spring Boot有四大神器,分别是auto-configuration.starters.cli.actuator,本文主要讲actuator.actuator是spring boot提供 ...
- Springboot监控之一:SpringBoot四大神器之Actuator
介绍 Spring Boot有四大神器,分别是auto-configuration.starters.cli.actuator,本文主要讲actuator.actuator是spring boot提供 ...
- SpringBoot整合Swagger和Actuator
前言 本篇文章主要介绍的是SpringBoot整合Swagger(API文档生成框架)和SpringBoot整合Actuator(项目监控)使用教程. SpringBoot整合Swagger 说明:如 ...
- SpringBoot要点之使用Actuator监控
Actuator是Springboot提供的用来对应用系统进行自省和监控的功能模块,借助于Actuator开发者可以很方便地对应用系统某些监控指标进行查看.统计等. 在pom文件中加入spring-b ...
随机推荐
- 2019-08-26 linux
1.question:什么是linux? answer:Linux由林纳斯·托瓦兹开发的一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和Unix的多用户.多任务.支持多线程和多CPU ...
- 判读是不是对象字面量(纯对象)。对象字面量创建方式有{}、new Object()创建
//判读是否是自身属性 function isHasPro(obj,pro){ return obj.hasOwnProperty(pro) ? true : false; } //判读是不是对象字面 ...
- 8、如何将本地新创建的项目上传到gitHub(gitLab)上
Git 常用命令 1. cd 项目目录 2.git init //变成git仓库 3.git add . //将项目添加到本地仓库 4.git commit -m '备注' //将项目提交 ...
- docker 网络模式 和 端口映射
docker 的 网络模式 docker 自带 3 种 网络模式:分别是bridge网络,host网络,none网络,可以使用 docker network ls 命令查看. 1.none网络 这 ...
- 第一部分day4-三次登录实验、字符编码
#-----三次登录实验----- memu = { "陕西":{ "西安市":{ "新城区":["大明宫遗址",&qu ...
- istio部署-helm
参考 istio/istio istio/Kubernetes Customizable Install with Helm Istio安装参数介绍 1. Istio Chart 目录结构 PATH: ...
- 【转】Pandas学习笔记(四)处理丢失值
Pandas学习笔记系列: Pandas学习笔记(一)基本介绍 Pandas学习笔记(二)选择数据 Pandas学习笔记(三)修改&添加值 Pandas学习笔记(四)处理丢失值 Pandas学 ...
- Linux传输指令-scp
本地传到远程 scp -rf bt.plist cjp@centos:~/下载 从远程下载到本地 scp -rf cjp@centos:~/下载 ~ 参数详解 参数 描述 -a 尽可能将档案状态.权限 ...
- 【电脑】E470C如何关闭触摸板
经查 以这种方式关闭最为简单. 若E470C没有这个模块,就装一个! http://www.edowning.net/soft/145089.htm#downbtn2
- 【java】字符串截取
String a = 'abcdef';String a = a.substring(0,1); a = 'a'; substring(int beginIndex, int endIndex) be ...