0
点赞
收藏
分享

微信扫一扫

Spring Boot bootstrap.yml如何外置

有时候我们是需要将bootstrap.yml文件的外置的,也即是说,在spring boot应用启动后,不直接使用jar包里面的bootstrap.yml文件,而是读取某个目录下的bootstrap.yml文件,然后进行覆盖。注意在spring boot 2.0之前的版本,得使用如下参数:

spring.config.location

完整配置如下:

nohup java $JAVA_OPTS -jar xxxx.jar --spring.config.location=/data/sc_config/bootstrap.yml

而如果是spring boot 2.0以及以后的版本,可以使用:

spring.cloud.bootstrap.location

完整配置如下:

nohup java $JAVA_OPTS -jar xxxx.jar --spring.cloud.bootstrap.location=/data/sc_config/bootstrap.yml

举报

相关推荐

0 条评论