今天整合ehcache时发现一个很重要的问题,就是程序关闭(硬关闭)之后,持久化到磁盘的缓存数据没能正确写入加载,问题还是硬关闭的问题,所以就使用actuator 进行监听

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

application.properties中添加(这里使用的是springboot2.x,所以management.endpoint替换了1.x的endpoints)

#启用shutdown

management.endpoint.shutdown.enabled=true

重启之后(/actuator 查看添加的监听接口)发现是没有需要的(/shutdown)

{
"_links": {
"self": {
"href": "http://localhost:8082/actuator",
"templated": false
},
"health": {
"href": "http://localhost:8082/actuator/health",
"templated": false
},
"info": {
"href": "http://localhost:8082/actuator/info",
"templated": false
}
}
}

application.properties中添加

management.endpoints.web.exposure.include=*

(/actuator/shutdown)正常返回

{
"message": "Shutting down, bye..."
}

修改默认(/actuator)前缀路径)application.properties中添加

management.endpoints.web.base-path=/system/actuator

springboot actuator shutdown正确的关闭操作的更多相关文章

  1. SpringBoot actuator 应用监控。

    前言 : 今天在阅读 <SpringCloud微服务实战>一书时看到了SpringBoot actuator相关知识,并且自己也本地调试实践.觉得SpringBoot这一套监控还是挺有意思 ...

  2. linux 如何正确的关闭mongodb

    有的朋友说可以通过下面的命令关闭mongodb: killall mongodb #or kill -9 mongo-pid 上面的方法确实可以关闭mongodb,但是正确的做法不是这样子的,mong ...

  3. springboot Actuator健康检查

    通过情况下,如我们想在系统中添加一个健康检查的接口,我们怎么做呢? 我们会新建一个类,或在已存在类的基础上添加检测接口. package com.crhms.medicareopinion; impo ...

  4. SpringBoot Actuator & SpringBoot Admin

    SpringBoot Actuator提供了很多监控和管理你的spring boot应用的HTTP或者JMX端点,并且你可以有选择地开启和关闭部分功能. 当你的spring boot应用中引入依赖之后 ...

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

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

  6. 论consul正确的关闭姿势

    最近在工作中发现一个有意思的现象,我用 ctrl+c 关闭本地 consul 的时候,报警系统并没有发出告警,说我的 node 异常,自己看了一下代码,发现 consul 的关闭还是有点猫腻的,仔细来 ...

  7. SpringBoot Actuator监控【转】

    springboot actuator 监控 springboot1.5和springboot2.0 的actuator在启动日志上的差异就很大了. springboot1.5在启动时会打印很多/XX ...

  8. springboot actuator 配置安全

    springboot actuator监控是什么?类似php的phpinfor()函数,不过actuator更强大,可以查看的数据.状态更多.Actuator是Spring Boot提供的对应用系统的 ...

  9. SpringBoot Actuator — 埋点和监控

    项目中看到了有埋点监控.报表.日志分析,有点兴趣想慢慢捣鼓一下 1. 数据埋点 监控机器环境的性能和业务流程或逻辑等各项数据,并根据这些数据生成对应的指标,那么我们就称为数据埋点.比如我们想知道某个接 ...

随机推荐

  1. 51nod-1346: 递归

    [传送门:51nod-1346] 简要题意: 给出一个式子a[i][j]=a[i-1][j]^a[i][j-1] 给出a[1][i],a[i][1](2<=i<=131172) 有n个询问 ...

  2. 细述 Java垃圾回收机制→Types of Java Garbage Collectors

    细述 Java垃圾回收机制→Types of Java Garbage Collectors 转自:https://segmentfault.com/a/1190000006214497 本文非原创, ...

  3. zzulioj--1780--和尚特烦恼6——炒股(贪心)

    1780: 和尚特烦恼6--炒股 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 154  Solved: 87 SubmitStatusWeb Boa ...

  4. MYSQL binlog 日志内容查看

    记录mysql数据库真正执行更改的所有操作(DML语句),不包含那些没有修改任何数据的语句,不会记录select和show这样的语句. 二进制日志的作用: 1. 可以完成主从复制的功能 2. 进行恢复 ...

  5. GetExecutingAssembly() 和 GetCallingAssembly() 的区别

    在TCX_1710项目代码的启动项目根目录路径下的Global.asax.cs配置文件中的MVCApplication类中的Application_Start()方法中,配置了项目启动时要加载的项目信 ...

  6. 乌班图 之 设置镜像服务器 、设置屏幕分辨率QAQ

    设置镜像服务器 Ubuntu 中的大部分软件安装都是用apt命令,从Ubuntu的服务器上直接安装的. 但是国外你懂的网速是硬伤,因此要搞个镜像服务器,内容当然都是一样的咯. 第一步:进入系统设置 第 ...

  7. Caffe 激励层(Activation)分析

    Caffe_Activation 一般来说,激励层的输入输出尺寸一致,为非线性函数,完成非线性映射,从而能够拟合更为复杂的函数表达式激励层都派生于NeuronLayer: class XXXlayer ...

  8. 使用python进行分页操作

    class getPage: """通过这个类 获取 开始和结束点""" def __init__(self,page): try: sel ...

  9. C# 将string 转换为二维码图片,然后转为base64字符串编码 。

    需在nuget 添加此dll ///content字符串 public static string GetQRCode(string content, int moduleSize = 9) { va ...

  10. vue 事件参数传$event打印当前组件

    <template> <div class="hello"> <button v-on:click.once="getinfo($event ...