Spring Boot Multiple Configuration File
There are many ways you could set up multiple configuration file in Spring Boot application. In last tutorial you saw how to create application with default configuration file.
- If you need to use common properties file just put application.properties in \src\main\resources\ folder and Spring Boot load this file as default. If you want use multiple configuration where some of them is load based on the environment then you will have define properties file accordingly. Let’s see from sample project below:
- As you see above properties file created accordingly based on environment. Default properties will be read from application.properties file and to load other properties file you will have to pass spring.config.location using below VM argument separated by comma:
- For more information please visit Spring official documentation here
Download complete project: SpringBootTomcat