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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.