It's possible to include the version of Spring Boot in the banner.txt by adding ${spring-boot.version}
.
How can I do the same for the /info
actuator endpoint?
I've tried adding both of the following to my application properties, but no luck:
info.app.spring-boot.version=${spring-boot.version}
[email protected]@
The /info
endpoint will print "${spring-boot.version}" (or "@spring-boot.version@" ), doesn't resolve the placeholder variable
My next idea was to create a Maven property for the Spring Boot version and reference it in the parent section like so
<properties>
<spring.boot.version>1.5.3.RELEASE</spring.boot.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring.boot.version}</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
But this didn't work because Maven resolves placeholder variables AFTER handling the <parent>
section
UPDATE
The following does work, but it's not ideal:
@Component
public class MyInfoContributor implements InfoContributor {
@Override
public void contribute(Info.Builder builder) {
builder.withDetail("spring-boot.version", SpringBootVersion.getVersion());
}
}
@prop@
. However I would probably go for theInfoContributor
. – Urethroscope