Spring Actuator /info 返回一个空主体

Bha*_*Yes 7 java spring-boot spring-boot-actuator

如何在2.7.0 Actuator/info中向端点添加自定义指标?Spring Boot

pom.xml

<version>0.0.1-SNAPSHOT</version>
...
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
    <version>2.7.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

目前与执行器相关的有以下几种。

应用程序属性

info.app.version=@project.version@

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

info.app.version我已经验证可以使用 检索该属性@Value。但尽管如此,我只得到了空洞的回应/info

响应头:

< HTTP/1.1 200 
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Content-Type: application/vnd.spring-boot.actuator.v3+json
< Transfer-Encoding: chunked
< Date: Wed, 15 Jun 2022 04:12:47 GMT


* Received 7 B chunk
* Received 5 B chunk
* Connection #26 to host localhost left intact
Run Code Online (Sandbox Code Playgroud)

响应正文:

{}
Run Code Online (Sandbox Code Playgroud)

我的理解是端点下的任何属性info都包含在/info端点中。或者这在执行器 v2+ 上不起作用? 来源