I have a Spring Boot based application packaged as a .war and can execute it directly using Java as follows:
java -jar build/libs/sample-project-0.1.0.war --spring.profiles.active=dev
Is there a way to provide a value for user.timezone as a JVM argument?
I've tried the following but none set the user.timezone property:
java -jar build/libs/sample-project-0.1.0.war --spring.profiles.active=dev -Duser.timezone=America/New_York
java -jar build/libs/sample-project-0.1.0.war --spring.profiles.active=dev -Dspring-boot.run.jvmArguments="-Duser.timezone=America/New_York"
Let's take a look at java command help:
in your case:
since
-Duser.timezone=America/New_Yorkargument is specified after-jaroption it is considered as main class argument and ignored by JVM, the correct command line is: