当前位置: 首页 > 知识库问答 >
问题:

Spring执行器endpoint给出404个错误,健康和信息除外

耿珂
2023-03-14
    null

在我的application.properties文件中,我启用了web应用程序默认禁用的所有endpoint(按照https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints-exposing-endpoints)。

我希望能够访问所有的执行器endpoint。但是,除了http://localhost:8080/actulator/health和http://localhost:8080/actulator/info之外,所有endpoint都有404s

我的application.properties文件如下:

# Source: https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints-exposing-endpoints

management.auditevents.enabled=true
management.endpoint.beans.enabled=true
management.endpoint.caches.enabled=true
management.endpoint.conditions.enabled=true
management.endpoint.configprops.enabled=true
management.endpoint.env.enabled=true
management.endpoint.flyway.enabled=true

# true by default
#management.endpoint.health.enabled=true

management.endpoint.heapdump.enabled=true
management.endpoint.httptrace.enabled=true

# true by default
#management.endpoint.info.enabled=true

management.endpoint.integrationgraph.enabled=true
management.endpoint.jolokia.enabled=true
management.endpoint.logfile.enabled=true
management.endpoint.loggers.enabled=true
spring.liquibase.enabled=true
management.endpoint.metrics.enabled=true
management.endpoint.mappings.enabled=true
management.endpoint.prometheus.enabled=true
management.endpoint.scheduledtasks.enabled=true
management.endpoint.sessions.enabled=true
management.endpoint.shutdown.enabled=true
management.endpoint.threaddump.enabled=true

共有1个答案

公良莫希
2023-03-14

看起来您需要在启用endpoint之后指定要公开的endpoint。

从文档2.2:

*可用于选择所有endpoint。例如,要通过HTTP公开除env和beanendpoint之外的所有内容,请使用以下属性:

 类似资料:
  • {“Status”:“Down”} 我需要做什么才能显示自定义健康状况指示器?

  • 但我想要一些我可以调用从AWS弹性负载均衡器/自动缩放组。默认情况下,如果一个实例未通过健康检查,ELB/ASG将终止它并用一个新的实例替换它。问题是一些健康检查,如DataSourceHealthIndicator,会在数据库关闭时向下报告,但我的应用程序实例在其他方面是完全健康的。如果我使用默认行为,AWS将抛出完全正常的实例,直到数据库重新启动,这将导致我的账单增加。 我可以去掉DataSo

  • 在我们的Spring Boot应用程序中,我们使用对可以访问我们应用程序的用户进行身份验证。我们在身份验证功能上没有看到任何问题,但是当我们点击URL时,我们会得到LDAP的以下状态: 在跟踪此空指针异常时,我们在尝试访问时获得此跟踪: 最后,下面是我们的安全配置的样子: 现在我们确实在控制台中得到一条消息,说,但这是我们的预期,我们对此很满意。看来健康终点并不尊重这一点。我不知道这是我们的代码的

  • 我正在使用SpringBoot执行器返回应用程序的运行状况。 我看到了下面的回复 我想返回一个类似于下面的响应 有办法做到吗?

  • 我应该做什么来获取其他endpoint,比如:度量、bean、缓存等?

  • 第一次尝试执行器依赖关系时,我将其配置为选入 当我在本地调用时,大约需要1.4秒来响应。请记住,这是一个本地调用,来自服务器的同一台机器。 如果我创建了一个以空响应进行响应的常规endpoint,则请求只需几毫秒。 这正常吗?我能让它回复快一点吗?