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 ...
随机推荐
- Java内存泄漏解析!
前言: 内存管理是Java最重要的优势之一,你只需创建对象,Java垃圾收集器会自动负责分配和释放内存.但是,情况并不那么简单,因为在Java应用程序中经常发生内存泄漏. 本章会说明什么是内存泄漏,为 ...
- windows下搭建vue+webpack的开发环境
1. 安装git其右键git bash here定位比cmd的命令行要准确,接下来的命令都是利用git bash here.2. 安装node.js一般利用vue创建项目是要搭配webpack项目构建 ...
- 字符串的sizeof长度及strlen长度
在C/C++中,字符串是以零('\0')结尾的.比如,对于下面的字符串: "hello" 在最后一个字符'd'后面,还有一个我们肉眼看不见的'\0'字符,作为该字符串的结束符.所 ...
- Centos7允许使用密码登录
现在使用云主机比较多,所以一般都是使用秘钥登录,当做一个集群的时候需要几台机器之间免密登录时,就需要修改他的配置文件了,刚做运维那会儿,很熟练,现在忘得差不多了,特此记录一下,下次又这个需求时就不 ...
- springboot日常问题处理手记
springboot启动问题 1.@Autowired报错Could not autowire. No beans of xxx 解决:只需在DAO接口加上@Component 或者 @Reposit ...
- 阿里云 OSS文件存储挂到云服务器ESC文件系统中
ossfs能让您在Linux系统中,将对象存储OSS的存储空间(Bucket)挂载到本地文件系统中,您能够像操作本地文件一样操作OSS的对象(Object),实现数据的共享. 使用限制 ossfs使用 ...
- [转]【会话技术】Session技术
创建时间:6.29 & 6.30 一.Session技术 Session技术是将数据存储在服务器端的技术,会为每个客户端都创建一块内存空间 存储客户的数据,但客户端需要每次都携带一个标识ID ...
- np.append()
1.numpy.append() np.append(arr,values,axis=None) 功能:在array后面追加values 参数: arr:array_like 值将附加到此数组的副本. ...
- vue - 过滤器-钩子函数路由
一.关于路由 1.使用vue router 本质上是声明一种可以通过路径进行 挂子,用子 找到对应的 template 进行页面渲染 <!DOCTYPE html> <html la ...
- 4、组件注册-自定义TypeFilter指定过滤规则
4.组件注册-自定义TypeFilter指定过滤规则 4.1 FilterType.ANNOTATION 按照注解方式 4.2 FilterType.ASSIGNABLE_TYPE 按照给定的类型 @ ...