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. java request.getInputStream中文乱码解决方案

    请求时要指定为UTF-8,中文码码完美解决 /** * * 得到请求body字符串,一般用于content-type:application/json * */ public static Strin ...

  2. 【转】fastjson-1.2.47-RCE

    Fastjson <= 1.2.47 远程命令执行漏洞利用工具及方法,以及避开坑点 以下操作均在Ubuntu 18下亲测可用,openjdk需要切换到8,且使用8的javac > java ...

  3. Android viewPager+fragment实现滑页效果

    先上图,手指在手机向左或者向右滑就可以实现相应的页面切换. 先看activity_main.xml文件,非常简单,主要是三个标题TextView和viewpager <?xml version= ...

  4. SpringBoot+logback实现按业务输出日志到不同的文件

        公司有个项目,需要和几个第三方系统对接.这种项目,日志一定要记录详细,不然出了问题就是各种甩锅.虽然项目里面和第三方系统对接相关的业务记录的日志很详细,但是由于整个项目的日志都在一个文件中,排 ...

  5. 如何检查linux服务器是否被入侵

    被入侵服务器的症状 当服务器被没有经验攻击者或者自动攻击程序入侵了的话,他们往往会消耗 100% 的资源.他们可能消耗 CPU 资源来进行数字货币的采矿或者发送垃圾邮件,也可能消耗带宽来发动 DoS ...

  6. gradle应用

    官网下载 http://services.gradle.org/distributions/ 解压并配置环境 1.解压gradle到你想要的目录 2.配置环境变量 GRADLE_HOME=D:\gra ...

  7. destoon搜索伪静态失败解决办法

    今天给一个朋友调试DT6.0内核的站点,搜索中文出现http 403 forbidden,找了半天,很纳闷,最后一个一个查看源代码总算找到,在此分享给大家! 解决的方法: 1.找到include/sa ...

  8. sublime ctrl b突然不能用解决方法

    Sublime Text 2 ?ctrl+b 如果出现运行为空白,按ctrl+`来显示错误,如下所示,转载了一篇解决方案 ? 文章参考:http://eric.themoritzfamily.com/ ...

  9. nginx 请求文件 进行用户认证/鉴权: internal(限制为内部调用)

    在进行WEB开发时, 必然会遇到向用户返回文件的场景(如图片, 文档等等), 当返回的文件较小时, 我们可以直接通过接口以数据流的形式向前台返回, 因为文件较小, 因此也不会太过于影响响应速度及服务器 ...

  10. python基础之八:知识小结及补充

    一.python2 与python3 的区别 1.在2中print后可带扣号,也可不带,3中必须带,否则报错! #print 'hello python2' print('hello python3' ...