【问题标题】:404 when accessing Actuator endpoint访问 Actuator 端点时出现 404
【发布时间】:2021-11-05 11:46:09
【问题描述】:

我将compileOnly 'org.springframework.boot:spring-boot-starter-actuator' 添加到我的build.gradle,然后在Gradle 工具窗口中右键单击该项目并选择Refresh Gradle Dependencies。然后我将endpoints.health.enabled=true 添加到我的application.properties

当我启动我的应用程序并在 URL http://localhost:9000/application/health 上执行 GET 时,我得到以下信息:

{
    "timestamp": "2021-11-05T11:40:13.663+00:00",
    "path": "/application/",
    "status": 404,
    "error": "Not Found",
    "message": null,
    "requestId": "c8352103-2"
}

启用执行器时我错过了什么吗?

【问题讨论】:

标签: java spring-boot spring-boot-actuator


【解决方案1】:

假设您使用的是 Spring Boot 2.x,默认情况下,所有 Actuator 端点都放在 /actuator 路径下,因此请尝试使用 http://localhost:9000/actuator/health。如果application 确实是您的上下文路径的一部分,请尝试http://localhost:9000/application/actuator/health

另外,compileOnly 'org.springframework.boot:spring-boot-starter-actuator' 应该是 implementation 'org.springframework.boot:spring-boot-starter-actuator'

【讨论】:

猜你喜欢
  • 2016-06-01
  • 1970-01-01
  • 2020-09-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-08
  • 2020-02-18
  • 2015-07-22
相关资源
最近更新 更多