I\'m trying to display the application version of my Spring Boot application in a view. I\'m sure I can access this version information, I just don\'t know how.
I tr
As described in the reference documentation, you need to instruct Gradle to process you application's resources so that it will replace the ${version}
placeholder with the project's version:
processResources {
expand(project.properties)
}
To be safe, you may want to narrow things down so that only application.properties
is processed:
processResources {
filesMatching('application.properties') {
expand(project.properties)
}
}
Now, assuming that your property is named info.build.version
, it'll be available via @Value
:
@Value("${info.build.version}")