Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change profile in application.properties file

I'm using Spring boot to build an app, but don't know ow to change profile in application.properties file. For example, I want to have 2 profiles: "dev" and "server" in my application. How could I do that?


2 Answers

The following example shows how to change profile in an application.properties file:

spring.profiles.active= server
like image 86
dogall Avatar answered Oct 19 '25 22:10

dogall


You can specify spring.profiles.active property in application.property file which will be the default to be used. Create application-dev.properties and application-server.properties for your specific properties.

Application will start with profile as specified in spring.active.profile property. You can override this by providing command line argument -Dspring.profiles.active.

like image 24
nonysingh Avatar answered Oct 19 '25 22:10

nonysingh