简体   繁体   中英

How to run Spring Boot with external configuration in Windows CMD?

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?

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

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

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

See if it works.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM