如图建立spring.factories文件 内容如下:
org.springframework.context.ApplicationListener=
org.springframework.boot.context.ApplicationPidFileWriter,
org.springframework.boot.web.context.WebServerPortFileWriter
启动项目时当前目录会建立application.pid application.port两个文件
怎么发送http请求停止项目
1.引入依赖
org.springframework.boot spring-boot-starter-actuator
然后将shutdown节点打开,也将/actuator/shutdown暴露web访问也设置上,除了shutdown之外还有health, info的web访问都打开的话将management.endpoints.web.exposure.include=*就可以。将如下配置设置到application.yml里边。



