Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bind Spring Boot application name to rootProject.name from Gradle?

I would like to set the application name in Spring Boot to the value from rootProject.name. Is there a way to do that?

like image 282
pixel Avatar asked Oct 31 '25 19:10

pixel


1 Answers

Spring Boot reads the application name from the configuration property spring.application.name. Gradle can generate a configuration file containing that property.

Put in the src/main/resources/application.properties file:

spring.application.name=${rootProject.name}

Add the Gradle task:

processResources {
  filesMatching("application.properties") {
    expand project.properties
  }
}
like image 67
Chin Huang Avatar answered Nov 02 '25 12:11

Chin Huang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!