spring-boot - 如何在环境或系统属性中指定 application.properties 的路径? [英] spring-boot - how to specify path of application.properties in envrionment or system properties?

查看:62
本文介绍了spring-boot - 如何在环境或系统属性中指定 application.properties 的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想运行 spring boot 应用程序,并且想在不同的路径中使用不同的 application.properties(除了使用配置文件)

If I want to run spring boot application, and want to use difference application.properties in difference path (other than using profile)

如何为 application.properties 指定路径?

推荐答案

如果要在不同的路径中使用不同的application.properties,使用该命令启动jar文件

If you want to use difference application.properties in difference path, use this command to start the jar file

nohup java -jar project.jar --spring.config.location=file://{file-path}/application.properties 

这篇关于spring-boot - 如何在环境或系统属性中指定 application.properties 的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆