如何让 Spring Boot v2.0.0.M7 Actuator 的关机工作? [英] How to make Spring Boot v2.0.0.M7 Actuator's shutdown work?

查看:31
本文介绍了如何让 Spring Boot v2.0.0.M7 Actuator 的关机工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了 hello world Spring Boot v2.0.0.M7 应用程序,添加了执行器,启用了关机,但它不起作用.

I created hello world Spring Boot v2.0.0.M7 app, added actuator, enabled shutdown and it isn't working.

application.properties

application.properties

server.port=8082
endpoint.shutdown.enabled=true
endpoint.shutdown.sensitive=false

健康状况良好

但不是关机

我做错了什么?

推荐答案

端点在 Spring Boot 2.0 中发生了很大变化,因此,您的配置已过时.您需要启用端点并通过 HTTP 公开它:

Endpoints have changed quite a bit in Spring Boot 2.0 and, as a result, your configuration is out of date. You need to enable the endpoint and also expose it over HTTP:

management.endpoints.web.expose=*
management.endpoint.shutdown.enabled=true

如评论中所述,并在 Actuator HTTP API 文档,您还需要发出 POST 请求,因此无法在浏览器中访问端点.你可以在命令行上使用类似 curl 的东西:

As already noted in the comments, and described in the Actuator HTTP API documentation, you also need to make a POST request so accessing the endpoint in your browser won't work. You can use something like curl on the command line instead:

$ curl -X POST localhost:8080/actuator/shutdown

您可以通过阅读 发行说明.

这篇关于如何让 Spring Boot v2.0.0.M7 Actuator 的关机工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆