Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does spring use application-dev.properties vs application.properties

I've got several Spring Boot applications. All of them are maven projects and in all of them, I have separate configuration files for different environments, like application.properties, application-dev.properties, application-uat.properties. When I run the application on from IDE it sometimes reads from application.properties file and sometimes from application-dev.properties file. I use IntelliJ IDEA for development and I haven't been able to figure out what determines which file to read from. Is it IDE dependent or is there some configuration in Spring that decides which properties file to pick?

like image 920
Mikayil Abdullayev Avatar asked Jul 18 '26 14:07

Mikayil Abdullayev


1 Answers

Most probably some of your Run configurations in Idea have configured Spring "profile" to run with. When you run Spring Boot application with, e.g., "dev" profile, then application-dev.properties file will be read in addition to application.properties. See here for more info

like image 67
Nikem Avatar answered Jul 20 '26 07:07

Nikem



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!