config client 端能连上 config server端,但是读取不到配置文件,导致client端读取时报错,启动不了
下面贴上配置文件
server端的yml
spring:
application:
name: config-server
cloud:
config:
server:
git:
uri: https://gitee.com/xxx/study-clouds-config
username: xx
password: xx
eureka:
client:
service-url:
defalutZone: http://localhost:8761
client端,需要配置到bootsrap.yml文件中,引导上下文的时候,bootstrap具有更高的优先级
spring:
application:
name: client
cloud:
config:
uri: http://localhost:8077
profile: test
eureka:
client:
service-url:
defalutZone: http://localhost:8761
instance:
prefer-ip-address: true #将ip注册到eureka实例
git上的config 文件名一定要与client端的 文件前缀一样
这样才能访问到正确的信息