0
votes

I have a Spring Boot application and I'm runnig it java -jar command on CMD. But I need to use external config file that is application.properties in C:\ folder. To do this I'm running the application with this command:

java -jar app.jar --spring.config.name=application --spring.config.location=file:///C:/

But command doesn't cares the spring.config.location property and application.properties file can't be found. Because of this the application not working.

How can I run the app with spring.config.name and spring.config.location parameters in Windows CMD?

2

2 Answers

0
votes

On Linux you should use file://sample-app/application.yml

On Windows you should use file:///C:/sample-app/application.yml

-1
votes

You try placing the jar and application.properties files in same folder and run java -jar yourapplication.jar

See if it works.