My intention is to have two profiles in a spring boot application - development and production one. Development profile is meant just to override some variables of production pr
We implemented the Spring active profiles in a slightly different way. Let's say the default properties file, application.yml
, contains all default values which is same in both production and development environments.
Create separate properties for production and development files named application-prd.yml
and application-dev.yml
respectively. These files may contain extra properties or override some of the default properties.
During application startup, we pass the spring.profiles.active
as an environment variable. For example,
-Dspring.profiles.active=prd
will pick up application-prd.yml
along with application.yml
or
-Dspring.profiles.active=dev
will pick up application-dev.yml
along with application.yml