Issue
How to create project architecture to support multiple envionment. Each environment will have different datasource from different property file like(dev-propertfile,test-propertyFil,Production-propertyfile) with help of spring's
org.springframework.core.env.Environment;
Solution
I'll give step by step procedure for Spring boot applications.
- Inside /src/main/resources/application.properties mention spring.profiles.active=dev (or Prod)
- Create /src/main/resources/application-dev.properties and give your custom dev configurations here.
- Create /src/main/resources/application-prod.properties and give your custom prod configurations here.
Run.
Answered By - USM
Answer Checked By - Clifford M. (JavaFixing Volunteer)