Sub topic 6
Publishing application, build, and git information
This chapter assumes you have added Actuator and can expose endpoints through management.endpoints.web.exposure.include. It also assumes you know basic Maven or Gradle configuration. The info endpoint answers a simple operational question: which version of the application is running right now?
What the info endpoint does
The info endpoint returns a JSON document with whatever descriptive data the application publishes. It is empty by default. Spring Boot fills it from InfoContributor beans, and each contributor adds one section.
| Contributor | Section | Source |
|---|---|---|
| `EnvironmentInfoContributor` | any key under `info.` | application properties |
| `BuildInfoContributor` | `build` | `META-INF/build-info.properties` |
| `GitInfoContributor` | `git` | `git.properties` on the classpath |
| `JavaInfoContributor` | `java` | the running JVM |
| `OsInfoContributor` | `os` | the host operating system |
The endpoint is exposed over HTTP only if you list it. Add info to the exposure list from the earlier chapter.
Publishing custom properties
Any property that starts with info. appears in the response. Static facts such as the team or a contact address belong here.
management:
endpoints:
web:
exposure:
include: health,info
info:
env:
enabled: true
info:
app:
name: Order Service
owner: platform-teamIn Spring Boot 3.x the env contributor is off by default, so management.info.env.enabled: true is required. Without it the info. properties are ignored and the endpoint stays empty.
Adding build information
The Spring Boot build plugin can generate META-INF/build-info.properties. It holds the group, artifact, name, version, and build time. With Maven, add the build-info goal to the plugin you already use for packaging.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>With Gradle, the equivalent is a springBoot block.
springBoot {
buildInfo()
}After a build, /actuator/info contains a build section. The BuildProperties bean is also available for injection if your code needs its own version number.
Adding git information
The git section shows the branch and commit that produced the artifact. This is the fastest way to confirm that a deployment contains the commit you expect. Generate git.properties with the Maven plugin below.
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
</plugin>For Gradle, apply the com.gorylenko.gradle-git-properties plugin. By default the endpoint shows only the branch, the abbreviated commit ID, and the commit time. To see the full set of git properties, change the mode.
management:
info:
git:
mode: full
build:
enabled: true
java:
enabled: true
os:
enabled: trueThe java and os contributors are also disabled by default, so the last two settings turn them on.
How the pieces fit together
A typical response looks like this:
{
"app": { "name": "Order Service", "owner": "platform-team" },
"build": { "version": "1.4.2", "artifact": "orders", "time": "2026-12-01T08:55:10.123Z" },
"git": { "branch": "main", "commit": { "id": "a1b2c3d", "time": "2026-12-01T08:41:02Z" } }
}Common errors
- Empty response. Either
infois not in the exposure list, or the contributor is disabled. Checkmanagement.info.env.enabledfor custom properties. - No
buildsection. Thebuild-infogoal did not run, or you started the app from an IDE before building. Runmvn packageor./gradlew buildonce. - No
gitsection.git.propertiesis missing from the classpath. This often happens when the build runs in a CI step without the.gitdirectory.
Exercise
You added info.app.name=Order Service to application.properties and exposed the info endpoint, but /actuator/info returns {}. What is the likely cause, and what is the fix?
Show answer
In Spring Boot 3.x the environment contributor is disabled by default. Set management.info.env.enabled=true and the app section will appear.