Mega Menu

Monday, April 13, 2020

SpringBoot Profiles

Profiles enable springboot to maintain environment specific configurations (host names, data source, credentials, properties). This is achieved by creating multiple application.properties files for each of the environment and either enable the profile through a property in default application.xml or a JVM argument.

Eg: application.properties               
      application-DEV.properties
      application-QA.properties

By defining this property in default application.properties, all the properties in application-DEV.properties are loaded.
       spring.profiles.active=DEV 

or even this can be enabled through a JVM property / VM Argument in RunConfigurations
     -Dspring.profiles.active=DEV

No comments:

Post a Comment