I have a spring-boot application that is configured with a yml file. Is it possible to override these properties when executing the jar? For example let say I have the input variable in yml file set to user1 and I want to execute the jar with user2. Is it possible to do something like this?
java -jar --input=user2
To elaborate answer by cLyric, you can do this:
java -jar yourapp.jar --input=user2
Or if you want to provide using json, you can do
java -jar yourapp.jar --spring.application.json='{"input":"user2"}'
Or if you're in unix/linux,
SPRING_APPLICATION_JSON='{"input":"user2"}' java -jar yourapp.jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With