How to read Bamboo MetaData in Spring Boot

Viewed 157

I am building a Spring Boot application using Bamboo. Is there any way I can read maven build related information like:

buildNumber and buildTimeStamp?

I have tried reading properties like below but they are not working.

@Value("${bamboo.buildNumber}")
private String buildNumber;

and

@Value("${buildNumber}")
private String buildNumber;

I think the bit I missing can be any of below:

  1. Bamboo is not writing properties to Jar exported to Artifactory.
  2. I am reading properties with wrong keys.
  3. I am missing some POM configuration.

Any help is much appreciated.

1 Answers

The @Value notation reads values from a properties file when you run the spring application. There is no way that properties which existed in the Bamboo environment at the time that your spring app was built will be available when you run your spring app, unless you take steps to make them available.

You will need to build a .properties file during the Bamboo build, and have this packaged into your spring boot application.

Related