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
You can reach the info actuator on your local machine: http://localhost:8080/actuator/info once you start your Spring Boot application.
The application runs on port 8080 by default. Once the actuator has started, we can see the list of all the endpoints exposed over HTTP. Let's invoke the health endpoint by invoking the URL http://localhost:8080/actuator/health. It denotes the status UP.
When we add Spring Actuator Dependencies to our spring boot project, it automatically enables actuator endpoints. Add below dependencies to your spring application to enable spring boot actuator endpoints. Now when you will run the application, you will see actuator endpoints being mapped in the logs.
Actuator is mainly used to expose operational information about the running application — health, metrics, info, dump, env, etc. It uses HTTP endpoints or JMX beans to enable us to interact with it. Once this dependency is on the classpath, several endpoints are available for us out of the box.
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@
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With