pom.xml 引用 actuator 监控插件
<!-- springboot监控 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.properties 中添加
#启用shutdown
endpoints.shutdown.enabled=true
停服时只需要 post 调用 注意是post
http://ip:post/shutdown
服务器就可以温柔的停止了