How to perform version control of applications when spring boots?

I use spring bootand gradlefor your application. The application may have different ones versions, and we need to show this version information of the application in the footer.

eg. 1.0.0 or 1.0.0.RELEASE etc

What are the possible ways to do this?

+1
source share
1 answer

There is a good example in the documentation . You can automatically extend the properties of the Gradle project and refer to these properties as placeholders in the file application.properties.

 processResources {
     expand(project.properties) 
 }

You can then reference your Gradle project properties through placeholders, for example.

app.name=${name} 
app.description=${description}

, , @Value, properties .

@Value("${app.version}")
public String appVersion;

@Override
public void run(String... arg0) throws Exception {
    System.out.println(appVersion);
}

, :

Gradle s Groovy s SimpleTemplateEngine, ${..}. ${..} Spring . Spring Spring \${..}.

P.S.: maven . ...

+1

Source: https://habr.com/ru/post/1653340/


All Articles