It’s really useful to have a simple way of seeing what code you have deployed.

Any Spring Boot application can add a simple git info endpoint using out-of-the-box actuator functionality and a simple maven plugin.

This allows you to do a simple curl on a URL and see exactly what version of your code is running by exposing the git info.

Step 1 – Create a Simple Spring Boot Application

The following command will use the spring initializer project to create a new spring boot application and place it in the /springboot directory.

curl -G -d dependencies=web,actuator -d baseDir=springboot -d groupId=com.sdbc | tar -xzvf -

Step 2 – Create your git repo

Run the following command to set up your git repo

cd springboot
git init
git add --all
git commit -m "initial code"
git remote add origin ./.git    # keep it all local

This will look as follows.

This enables the plugin to pull back the git info for the project.

Step 3 – Add the Maven plugin

Add the following plugin to your pom.xml.


The plugin will automatically add the build information to a file in the target/classes folder when you build your code.

Run the following command and then check the properties.

mvn clean install
Properties File Location

This contains all of the following information.

For full details on the plugin see the references below.

Step 4 – Expose the information.

By default, a Spring Boot application hides the info actuator endpoint. We generally change this in properties. But for this blog, we will just pass it as a property when running the application.

Start the application as below.

mvn spring-boot:run

You can then hit the endpoint in the browser.


git info exposed

Check the reference on the plugin to see how you can customise this information.