美文网首页
springboot jar文件指定yml

springboot jar文件指定yml

作者: 饱饱想要的灵感 | 来源:发表于2023-05-04 15:51 被阅读0次

启动Spring Boot时,可以在命令行中添加--spring.config.name--spring.config.location参数来指定配置文件的名称和位置。

例如,如果要使用名为application.yml的配置文件,可以在命令行中使用以下命令:
java -jar myapp.jar --spring.config.name=application --spring.config.location=/path/to/config/

这将告诉Spring Boot使用名为application.yml的配置文件,并将其位置设置为/path/to/config/

如果要使用多个配置文件,可以使用逗号分隔它们的名称:
java -jar myapp.jar --spring.config.name=application,myconfig --spring.config.location=/path/to/config/
这将告诉Spring Boot使用名为application.ymlmyconfig.yml的配置文件,并将它们的位置设置为/path/to/config/

相关文章

网友评论

      本文标题:springboot jar文件指定yml

      本文链接:https://www.haomeiwen.com/subject/mobxsdtx.html