我有一个Spring Boot应用程序,它监听JCAPS。这种连接是持久的。当我使用关闭应用程序时
Curl -X POST ip:port//shutdown应用程序未完全关闭。当我对进程执行grep时,我可以看到PID。所以我试着用
Kill -15 PID或
Kill -SIGTERM PIDPID已不存在,但JCAPS主题的订阅仍处于活动状态。因此,当我重新启动应用程序时,我无法使用相同的订阅者名称连接到相同的主题。
请帮助您正确关闭spring boot应用程序。
发布于 2019-09-28 16:42:16
在pom.xml中添加以下依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>在application.properties中设置以下属性
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
endpoints.shutdown.enabled=true然后启动spring-boot应用程序
你想关闭按照curl命令运行的应用程序
curl -X POST localhost:port/actuator/shutdown
https://stackoverflow.com/questions/45751482
复制相似问题