Creating multiple profiles for Spring Boot
Generally, web applications are deployed on different environments – first, they are run locally on a developer's machine, then deployed on test servers, and finally deployed on production servers. We would have the application interacting with components located in different places for each environment. The best approach for this is to maintain different profiles for each environment. One way to do this is by creating different versions of the application.properties
file, that is, different versions of the file that stores the application-level properties. These property files in Spring Boot can also be YML files, such as application.yml
. Even if you create different versions, you need a mechanism to tell your applications to pick the relevant version of the file, based on the environment it has been deployed to.
Spring Boot provides amazing support for such a feature. It allows you to have multiple configuration files, each representing a specific...