赞
踩
之前一直用kill -9来停止自己的程序,后来觉得这种方式太简单粗暴了,Spring Cloud/Boot应该有比较优雅方式停止程序(服务),后来在网上找到了一些中文版的通过非kill -9来停止服务的帖子,但是按照文章中的去操作都不成功,于是自己通过看英文的官方文档再加上自己的实践终于实现了目标。以下是具体的实现步骤。(ps:我的Spring Boot版本是2.0.3)
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
shutdown:
enabled: true
curl -X POST 192.168.20.177:1025/actuator/shutdown
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。