resources 与 myConfig
如下图:
最开始 我将 springbootService-release.properties 和 springbootService-releaseNew.properties 都放在 resources
配置resources 下的 application.yml 关于 git的地址如下:
cloud:
config:
server:
git:
uri: https://gitee.com/xxxx/springbootconfig
username: xxx
password: xxxx
default-label: master #配置文件分支
search-paths: resources #配置文件所在根目录
结果访问:http://localhost:6002/springbootService/release 得到的propertySources为null
在网上查了好多资料,几乎没有人在springboot项目 下resources 放动态配置文件的,所以 在项目根目录下新建了一个myConfig,将之前的配置文件放到这个目录下,然后修改配置:
cloud:
config:
server:
git:
uri: https://gitee.com/xxxx/springbootconfig
username: xxx
password: xxxx
default-label: master #配置文件分支
search-paths: myConfig #配置文件所在根目录
结果访问http://localhost:6002/springbootService/release 得到的propertySources不为null,是自己设置的内容