我正在使用带有弹簧护套的弹簧执行器来检查我的服务的运行状况。我正在使用openJdk11。并使用:
Spring-boot依赖项:
'org.springframework.boot' version '2.1.3.RELEASE'
执行器依赖性:
'org.springframework.boot:spring-boot-starter-actuator:2.1.6.RELEASE'
这一切正常时,意味着我在浏览器中尝试http://localhost:9000/actuator/health时会得到提示:
我需要通过以下方式返回相同的答复:
http://localhost:9000/health
有办法吗?
请让我知道是否需要进一步说明。
答案 0 :(得分:1)
通过设置属性management.endpoints.web.base-path
。
在documentation
答案 1 :(得分:1)
Spring Boot Actuator自动配置所有启用的端点以通过HTTP公开。默认约定是使用前缀为/actuator
的端点的 id 作为URL路径。例如,健康状况显示为/actuator/health.
例如,您的应用程序可能已将/actuator
用于其他目的。您可以使用management.endpoints.web.base-path
属性来更改管理端点的前缀
management.endpoints.web.base-path=/manage
前面的 application.properties 示例将端点从/actuator/{id} to /manage/{id}
(例如/manage/health
)更改。