我正在使用Spring Boot执行器来获取我的应用程序信息。
我在我的pom.xml中添加了Spring Boot执行程序依赖项,并在我的属性文件中添加了以下行:
info: app: name: @project.name@ description: @project.description@ version: @project.version@我从pom.xml获取值:我的项目的名称,描述和版本。 我还想获得构建时间并将其显示在/info端点上。
有什么建议么?
我是否还应该更改我的pom.xml文件? 我试过用:
info.app.build-time=@build-time@但这不起作用。
谢谢
I am using the Spring Boot actuator to get my application's info.
I have added the Spring Boot actuator dependency in my pom.xml, and added below lines in my property file:
info: app: name: @project.name@ description: @project.description@ version: @project.version@I get the values: name, description and version of my project from pom.xml. I also want to get build time and display it on the /info endpoint.
Any suggestions?
Should I also Change my pom.xml file for it? I tried using :
info.app.build-time=@build-time@But this doesnt work.
Thanks
最满意答案
您可以在pom.xml中定义timestamp Maven属性,如下所示:
<properties> <timestamp>${maven.build.timestamp}</timestamp> <maven.build.timestamp.format>yyyy-MM-dd-HH:mm</maven.build.timestamp.format> </properties>然后使用@...@约定引用它,如下所示:
info: app: timestamp: @timestamp@You can define a timestamp Maven property in your pom.xml like so:
<properties> <timestamp>${maven.build.timestamp}</timestamp> <maven.build.timestamp.format>yyyy-MM-dd-HH:mm</maven.build.timestamp.format> </properties>And then reference it using the @...@ convention like so:
info: app: timestamp: @timestamp@在Spring Boot执行器信息端点中显示构建时间戳(Display build timestamp in Spring Boot actuator info endpoint)我正在使用Spring Boot执行器来获取我的应用程序信息。
我在我的pom.xml中添加了Spring Boot执行程序依赖项,并在我的属性文件中添加了以下行:
info: app: name: @project.name@ description: @project.description@ version: @project.version@我从pom.xml获取值:我的项目的名称,描述和版本。 我还想获得构建时间并将其显示在/info端点上。
有什么建议么?
我是否还应该更改我的pom.xml文件? 我试过用:
info.app.build-time=@build-time@但这不起作用。
谢谢
I am using the Spring Boot actuator to get my application's info.
I have added the Spring Boot actuator dependency in my pom.xml, and added below lines in my property file:
info: app: name: @project.name@ description: @project.description@ version: @project.version@I get the values: name, description and version of my project from pom.xml. I also want to get build time and display it on the /info endpoint.
Any suggestions?
Should I also Change my pom.xml file for it? I tried using :
info.app.build-time=@build-time@But this doesnt work.
Thanks
最满意答案
您可以在pom.xml中定义timestamp Maven属性,如下所示:
<properties> <timestamp>${maven.build.timestamp}</timestamp> <maven.build.timestamp.format>yyyy-MM-dd-HH:mm</maven.build.timestamp.format> </properties>然后使用@...@约定引用它,如下所示:
info: app: timestamp: @timestamp@You can define a timestamp Maven property in your pom.xml like so:
<properties> <timestamp>${maven.build.timestamp}</timestamp> <maven.build.timestamp.format>yyyy-MM-dd-HH:mm</maven.build.timestamp.format> </properties>And then reference it using the @...@ convention like so:
info: app: timestamp: @timestamp@
发布评论