今天整合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. linux 下面avr开发环境的安装

    (1)安装开发工具链 yum install avr-* 会安装以下的工具 avr-gcc-4.7.2-1.fc17.i686avr-libc-1.8.0-2.fc17.noarchavr-binut ...

  2. PCA(Principal Components Analysis)主成分分析

    全是图片..新手伤不起.word弄的,结果csdn传不了..以后改. .

  3. c语言中类型转换与赋值运算符、算术运算符、关系运算符、逻辑运算符。原码、反码、补码。小解。

    类型转换 自动转换 小范围的类型能够自动转换成大范围的类型.short->int->long->float->double 强制类型转换 (类型名)变量或数值 #include ...

  4. zzulioj--1634--Happy Thanksgiving Day - A + B Problem(模拟水题)

     1634: Happy Thanksgiving Day - A + B Problem Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 136  ...

  5. 如何显示bootstrap fileinput缩略图上面的删除按钮

    bootstrap上传文件控件初始化js: //bootstrap上传文件控件 $(".fileupload").fileinput({ language: "zh&qu ...

  6. 循环访问 TreeView 控件的所有节点

    创建测试每个节点的递归过程 . private void PrintRecursive(TreeNode treeNode) { // Print the node. System.Diagnosti ...

  7. word2tex之类的问题

    首先就是这个word2tex一般是在word和tex文本互相转换的时候用的. 以前win7下用的chikrii忘了使用方法.. 之后再win10下用的excel2tex,但是转换时候总感觉不如word ...

  8. HDU 1087 Super Jumping! Jumping! Jumping!【DP】

    解题思路:题目的大意是给出一列数,求这列数里面最长递增数列的和 dp[i]表示到达地点i的最大值,那么是如何达到i的呢,则我们可以考虑没有限制条件时候的跳跃,即可以从第1,2,3,---,i-1个地点 ...

  9. JDOM,dom4j方式解析XML

    <?xml version="1.0" encoding="UTF-8"?> <dataSources> <!-- 定义MySQL ...

  10. 在远程X server上显示图形的设置方法

    1.在服务器的/etc/ssh/sshd_config中,设置X11Forwarding yes,然后重启ssh服务,cd /etc/init.d这个目录下执行 ./ssh restart 2.在客户 ...