Spring Boot 2.6执行器信息

use*_*140 6 java spring-boot spring-boot-actuator

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

management.endpoints.web.exposure.include=health,info
management.endpoint.info.enabled=true
management.info.defaults.enabled=true
Run Code Online (Sandbox Code Playgroud)

当我调用该网址时,/actuator我看到

{"_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}}}
Run Code Online (Sandbox Code Playgroud)

但当我打电话时/actuator/info它会返回我{}

我究竟做错了什么?

谢谢

use*_*140 15

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

management.info.env.enabled=true
Run Code Online (Sandbox Code Playgroud)

和价值

info.app.name=@project.name@
Run Code Online (Sandbox Code Playgroud)

由返回/actuator/info