I am having problem with Spring Boot and fat jar invocation from command line.I am trying to overide property from command line but without success.
I have parameter in the code:
@Value("${param1}")
private String param1;
and also I have put application.properties file inside src\main\resources with following content;
param1=Param 1 value from properties file
When I build jar and run with:
java -jar java-apns-notifier-0.1.0.jar --param1=Aaaaaaaaa
param1 is printed with value from application.properties file and not takes into account value from command line.
Project source code is here
Any idea?
You forgot to pass the arguments in your Application class. You just need to change
SpringApplication.run(Application.class);
to
SpringApplication.run(Application.class, args);
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