spring cloud config 默认端口号
无论你在 Config Server 中配置的端口号是什么,Config Client 启动时,都默认会去访问 Server 的 8888 端口。
解决方法: 在resources文件夹下,新建 bootstrap.properties 文件( bootstrap.yml 也可以) 这样,Client 启动后就会访问 Server 中配置的端口号了。
#配置在application.properties/yml都不行,必须是配置在bootstrap.properties/yml里面,否则还是会取本机的8888端口!!! #官网原话:Bootstrap properties are added with high precedence, so they cannot be overridden by local configuration, by default. server.port=8088 spring.application.name=config-client eureka.client.service-url.defaultZone=http://localhost:8081/eureka/ spring.cloud.config.label=master spring.cloud.config.profile=dev # 这里必须配置为true,否则还是会取localhost:8888端口 spring.cloud.config.discovery.enabled=true spring.cloud.config.discovery.service-id=config-server #设为true,如果无法连接config server,启动时会抛异常,并停止服务 spring.cloud.config.failFast=true
