6

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?

Rajib Biswas
  • 772
  • 10
  • 27
  • 2
    Check out https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/#run-example-application-arguments – Simon Martinelli Jul 16 '20 at 11:46
  • Hi @SimonMartinelli, As per the maven-plugin documentation, I have tried following, but that also didn't work: mvn spring-boot:run -Dspring-boot.run.arguments="jwt.validateExp=false jwt.skipValidation=true" – Rajib Biswas Jul 16 '20 at 13:10
  • A guess in the wild. Can you try -Drun.arguments – Simon Martinelli Jul 16 '20 at 13:23
  • This worked: -Dspring-boot.run.arguments="--jwt.validateExp=false --jwt.skipValidation=true" Thanks for your suggestion. – Rajib Biswas Jul 16 '20 at 13:29
  • where is this in their changelog notes? ? ? ? https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes – Ryu S. Nov 10 '20 at 19:19

2 Answers2

8

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 (,).

Rajib Biswas
  • 772
  • 10
  • 27
3

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"