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的更多相关文章

  1. Springboot Actuator之八:actuator的执行原理

    本文接着<Springboot Actuator之七:actuator 中原生endpoint源码解析1>,前面主要分析了原生endpoint的作用. 现在着重了解actuator的执行原 ...

  2. SpringBoot系列(九)单,多文件上传的正确姿势

    SpringBoot系列(九)分分钟解决文件上传 往期推荐 SpringBoot系列(一)idea新建Springboot项目 SpringBoot系列(二)入门知识 springBoot系列(三)配 ...

  3. Springboot Actuator之七:actuator 中原生endpoint源码解析1

    看actuator项目的包结构,如下: 本文中的介绍Endpoints. Endpoints(端点)介绍 Endpoints 是 Actuator 的核心部分,它用来监视应用程序及交互,spring- ...

  4. Springboot监控之一:SpringBoot四大神器之Actuator之3-springBoot的监控和管理--指标说明

    Spring Boot包含很多其他的特性,它们可以帮你监控和管理发布到生产环境的应用.你可以选择使用HTTP端点,JMX或远程shell(SSH或Telnet)来管理和监控应用.审计(Auditing ...

  5. Spring Boot]SpringBoot四大神器之Actuator

    论文转载自博客: https://blog.csdn.net/Dreamhai/article/details/81077903 https://bigjar.github.io/2018/08/19 ...

  6. SpringBoot四大神器之Actuator

    介绍 Spring Boot有四大神器,分别是auto-configuration.starters.cli.actuator,本文主要讲actuator.actuator是spring boot提供 ...

  7. Springboot监控之一:SpringBoot四大神器之Actuator

    介绍 Spring Boot有四大神器,分别是auto-configuration.starters.cli.actuator,本文主要讲actuator.actuator是spring boot提供 ...

  8. SpringBoot整合Swagger和Actuator

    前言 本篇文章主要介绍的是SpringBoot整合Swagger(API文档生成框架)和SpringBoot整合Actuator(项目监控)使用教程. SpringBoot整合Swagger 说明:如 ...

  9. SpringBoot要点之使用Actuator监控

    Actuator是Springboot提供的用来对应用系统进行自省和监控的功能模块,借助于Actuator开发者可以很方便地对应用系统某些监控指标进行查看.统计等. 在pom文件中加入spring-b ...

随机推荐

  1. MySQL语言分类——DDL

    DDL的全称Data Definition Language,即数据定义语言 DDL的语法有:create.alter.drop.rename.truncate.对此做一个详细的解释: create ...

  2. Spring Cloud入门

    Spring Cloud为开发者开发分布式应用提供了便捷工具(包括配置管理.服务发现.断路器.智能路由.微服务代理.控制总线.一次性令牌.全局锁.领导者选举.分布式会话.集群状态等).为开发分布式应用 ...

  3. vue+element表单校验功能

    要实现这个功能其实并不难,element组件直接用就可以, 但是我在使用过程中碰到了几个坑,就记录下来,分享给大家,避免落坑,话不多说,直接上过程...... 表单校验功能:   实现这个功能,总共分 ...

  4. LoadRunner脚本录制常见问题

    LoadRunner录制脚本时为什么不弹出IE浏览器?当一台主机上安装多个浏览器时,LoadRunner录制脚本经常遇到不能打开浏览器的情况,可以用下面的方法来解决. 启动浏览器,打开Internet ...

  5. CEF 拦截打开超链接事件

    使用 CEF 加载指定页面后,如果你希望控制页面在打开超链接时根据自己预定义的一些行为来操作,比如在自己的 UI 框架中新建一个 Tab 页又或者阻止打开新的页面等.我们就需要通过 CEF 提供的两个 ...

  6. Python基础之输出格式和If判断

    格式化输出的三种方式 一.占位符 #占位符 name = 'nick' age = 19 print('my name is %s my age is %s' % (name, age)) age = ...

  7. JDOJ 2982: 最大连续子段和问题

    洛谷 P1115 最大子段和 洛谷传送门 JDOJ 2982: 最大连续子段和问题 JDOJ传送门 题目描述 给出一段序列,选出其中连续且非空的一段使得这段和最大. 输入格式 第一行是一个正整数NN, ...

  8. HTML基础一-html、CSS

    一.HTML标签 前端语言 HTML-将页面展现出来    CSS-修饰前端标签 让HTML更好看 css 对html 进行修饰    JS-能够让页面动起来 HTML htyper text mar ...

  9. 4、组件注册-自定义TypeFilter指定过滤规则

    4.组件注册-自定义TypeFilter指定过滤规则 4.1 FilterType.ANNOTATION 按照注解方式 4.2 FilterType.ASSIGNABLE_TYPE 按照给定的类型 @ ...

  10. 第05组 Beta冲刺(2/4)

    第05组 Beta冲刺(2/4) 队名:天码行空 组长博客连接 作业博客连接 团队燃尽图(共享): GitHub当日代码/文档签入记录展示(共享): 组员情况: 组员1:卢欢(组长) 过去两天完成了哪 ...