Setting active profile and config location from command line in spring boot

There are two different ways you can add/override spring properties on the command line.

Option 1: Java System Properties (VM Arguments)

It’s important that the -D parameters are before your application.jar
otherwise they are not recognized.

java -jar -Dspring.profiles.active=prod application.jar

Option 2: Program arguments

java -jar application.jar --spring.profiles.active=prod --spring.config.location=c:\config

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)