Reputation: 21596
I build executable jar file(using gradle) of my spring-boot app:
I put application.properties file somewhere in my comp. for example:
/etc/test/application.properties
I run my jar this way:
java -jar my-app-0.0.1.jar --spring.config.location=etc/test/application.properties
I get error:
Caused by: java.io.FileNotFoundException: class path resource [application.properties] cannot be opened because it does not exist
what am I doing wrong ?
Thank you.
Upvotes: 2
Views: 8634
Reputation: 403
Try this -Dspring.config.location=file:/etc/test/application.properties
(I've tested it on windows with -Dspring.config.location=file:c:\application.properties
)
Upvotes: 5
Reputation: 21596
Problem was that I had additional annotation:
@PropertySource("classpath:application.properties")
which always override it
Upvotes: 3