By default, Spring Boot will look for your externalized properties in a file named located in one of the following folders :

  • classpath root
  • in the package /config in classpath
  • in the current directory
  • /config subdirectory of the current directory

You may want to use an externalized properties file in your Spring Boot application with a different name.  This tutorial will show 3 different ways to rename in Spring boot.

Consider we want to rename to

Command line arguments

The first way to rename in Spring boot is by using the command line argument --{YOUR_FILE_NAME}. Below an example :

If you are using Eclipse, below the steps to follow :

  • Right-Click on your Main class, Run As ->  Run configurations…
  • Go to Arguments tab
  • And in Program arguments region past :
  • Click Apply and then Run

Now Spring Boot will look for a file named located in classpath root, in the package /config in classpath, in the current directory or in /config subdirectory of the current directory.

Environment variable

 You can set the name of your externalized properties file in the SPRING_CONFIG_NAME environment variable as below :

If you work with eclipse and you set the SPRING_CONFIG_NAME as a global system environment variable, you need to restart your IDE.


You can rename the Spring Boot properties file programmatically as below :