【问题标题】:Spring boot 2.6 actuator infoSpring Boot 2.6 执行器信息
【发布时间】:2021-11-26 11:24:56
【问题描述】:

我正在使用执行器,在 application.properties 文件中我有以下字段

management.endpoints.web.exposure.include=health,info
management.endpoint.info.enabled=true
management.info.defaults.enabled=true

当我调用我看到的 url / 执行器时

{"_links":{"self":{"href":"https://localhost:8443/actuator","templated":false},"health":{"href":"https://localhost:8443/actuator/health","templated":false},"health-path":{"href":"https://localhost:8443/actuator/health/{*path}","templated":true},"info":{"href":"https://localhost:8443/actuator/info","templated":false}}}

但是当我调用 / actuator / info 时,它会返回给我 {}

我做错了什么

谢谢

【问题讨论】:

  • "info":{"href":"localhost:8443/actuator/info","templated":false} --> 该字段显示值,它应该返回 {"templated":false} 值,您在日志中看到任何错误吗?或者只是清除浏览器缓存并再次点击。
  • 我正在使用 curl no nho cache 进行调用,并且日志中没有错误。
  • 如果您在浏览器中点击 url,您会得到预期的响应吗?
  • 并不总是一个空对象
  • 意味着你只会得到一些空对象?

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


【解决方案1】:

我解决了问题,只需在application.properties文件中添加

management.info.env.enabled=true

和价值

info.app.name=@project.name@

由/执行器/信息返回

【讨论】:

    猜你喜欢
    • 2016-09-05
    • 2021-10-30
    • 2019-01-19
    • 1970-01-01
    • 1970-01-01
    • 2014-04-07
    • 2016-02-13
    • 2018-03-03
    • 2018-08-29
    相关资源
    最近更新 更多