How to load property file based on spring profiles

Santoshkumar Kalasa :

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;
USM :

I'll give step by step procedure for Spring boot applications.

  1. Inside /src/main/resources/application.properties mention spring.profiles.active=dev (or Prod)
  2. Create /src/main/resources/application-dev.properties and give your custom dev configurations here.
  3. Create /src/main/resources/application-prod.properties and give your custom prod configurations here.

Run.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=452612&siteId=1