Spring-Boot 2.3.1 -Dspring-boot.run.arguments not working

2.5k Views Asked by At

I have been using mvn spring-boot:run command with -Dspring-boot.run.arguments to pass arguments/variables to our spring-boot application, ex:

mvn spring-boot:run -Dspring-boot.run.arguments=--jwt.validateExp=false,--jwt.skipValidation=true

And in the application, I used to read the argument value using annotation: @Value("${jwt.skipValidation}"). This was working fine with spring-boot 2.2.1.

When I upgraded to spring-boot 2.3.1, this stopped working. Any suggestion?

2

There are 2 best solutions below

0
On BEST ANSWER

Changing --jwt.validateExp=false,--jwt.skipValidation=true to "--jwt.validateExp=false --jwt.skipValidation=true", did the trick for me.

mvn spring-boot:run -Dspring-boot.run.arguments="--jwt.validateExp=false --jwt.skipValidation=true"

So placed double quotes ("") around the arguments, and provided space in place of comma (,).

0
On

I'm using spring.boot 2.4.2 and to solve this, i separated the arguments with withe-space and put the values between double quotes.

mvn spring-boot:run -Dspring-boot.run.arguments="--jwt.validateExp=false --jwt.skipValidation=true"