SpringBoot应用正常关闭

简介

参考spring

https://www.jianshu.com/p/44ef43b282f0

这里只描述经过HTTP Shutdown安全

POM依赖

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

开启Spring Boot Actuator的配置

endpoints:
    shutdown:
        enabled: true  #启用shutdown
        sensitive: false #禁用密码验证

测试

curl -X POST localhost:8080/shutdown

特别说明

- 该方式支持远程调用,推荐在内网环境下使用
- 若是要增长安全设置请参考原文,本人未测试该特性
相关文章
相关标签/搜索