priya rajgopalan
priya rajgopalan

Reputation: 31

How do i run a executable springboot jar by setting a profile?

I am trying to set the profile as dev,but the spring boot app does not start in dev profile.No active profile set, falling back to default profiles: default.

i am running with the command :java -jar myapp.jar -Dspring.profiles.active=dev

Upvotes: 1

Views: 1797

Answers (3)

user1941489
user1941489

Reputation:

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

java -jar -Dspring.profiles.active=dev app.jar
or
mvn spring-boot:run -Drun.profiles=dev

Upvotes: 1

priya rajgopalan
priya rajgopalan

Reputation: 31

I was able to run it with the following: java -jar myapp.jar **--**spring.profiles.active=dev

Note that it needs to be -- and elimination of D

Upvotes: 2

pvpkiran
pvpkiran

Reputation: 27078

This is the right way to execute

java -Dspring.profiles.active=dev -jar myapp.jar

Upvotes: 1

Related Questions