More DevOps for Spring Boot

I think Spring Boot brings something new to the table, especially concerning DevOps - and I’ve already written a post about it. However, there’s more than metrics and healthchecks.

In one of another of my previous post, I described how to provide versioning information for Maven-built applications. This article will describe how this later post is not necessary when using Spring Boot.

As a reminder, just adding adding the spring-boot-starter-actuator dependency in the POM, enable many endpoints, among them:

  • /metrics for monitoring the application
  • /health to check the application can deliver the expected service
  • /bean lists all Spring beans in the context
  • /configprops lists all properties regarding the running profile(s) (if any)

Among those, one of them is of specific interest: /info. By default, it displays…​ nothing - or more precisely, the string representation of an empty JSON object.

However, any property set in the application.properties file (or one of its profile flavor) will find its way into the page. For example:

Propery file Output




 My Demo App

  "application" : {
    "name" : "My Demo App"

Setting static info is sure nice, but our objective is to get the version of my application within Spring Boot. application.properties files are automatically filtered by Spring Boot during the process-resources build phase. Any property in the POM can be used: it just needs to be set between @ character. For example:

Propery file Output





  "application" : {
    "version" : "0.0.1-SNAPSHOT"

Note that Spring Boot Maven plugin will remove the generated resources, and thus the application will use the unfiltered resource properties file from the sources. In order to keep (and use) the generated resources instead, configure the plugin in the POM like this:


At this point, we have the equivalent of the previous article, but we can go even further. The maven-git-commit-id-plugin will generate a git.properties stuffed will all possible git-related information. The following snippet is an example of the produced file:

#Generated by Git-Commit-Id-Plugin
#Fri Jul 10 23:36:40 CEST 2015
[email protected]
git.commit.message.full=Initial commit\n
git.commit.message.short=Initial commit
git.commit.user.name=Nicolas Frankel
git.build.user.name=Nicolas Frankel
[email protected]

From all of this data, only the following are used in the endpoint:

 Key Output


  "git" : {
    "branch" : "master",
    "commit" : {
      "id" : "bf4afbf",
      "time" : "2015-07-10T23:34:46+0200"



Since the path and the formatting is consistent, you can devise a cronjob to parse all your applications and generate a wiki page with all those information, per server/environment. No more having to ssh the server and dig into the filesystem to uncover the version.

Thus, the /info endpoint can be a very powerful asset in your organization, whether you’re a DevOps yourself or only willing to help your Ops.

To go further:

Nicolas Fränkel

Nicolas Fränkel

Developer Advocate with 15+ years experience consulting for many different customers, in a wide range of contexts (such as telecoms, banking, insurances, large retail and public sector). Usually working on Java/Java EE and Spring technologies, but with focused interests like Rich Internet Applications, Testing, CI/CD and DevOps. Also double as a trainer and triples as a book author.

Read More
More DevOps for Spring Boot
Share this