Config-Server针对于Git的各种配置
1、通配符
首先在github下创建两个repository,一个simple,一个special
simple和special里均有application.yml
文件内容分别是profile: simple和profile: special
准备好之后,将application.yml进行修改
server:
port: 8080
spring:
cloud:
config:
server:
git:
uri: https://github.com/wangchunself/{application}.git
skipSslValidation: true
原本的精准地址,被一个通配符替代{application}
启动config-server,访问http://localhost:8080/master/simple-dev.yml,得结果:

也就是说,它会自动根据我们访问的路径,拿到{application}对应的simple,然后在uri=https://github.com/wangchunself/simple.git下面进行查询,但是在simple下面没有simple-dev.yml,因此访问到application.yml文件。
同理,我们也可以将uri通配成https://github.com/wangchunself/{application}-{profile}.git,这种形式。
2、模式匹配
出现问题,随后的博客进行解答
浙公网安备 33010602011771号