spring cloud config 默认端口号

spring cloud config 默认端口号

2018年04月16日 15:30:51 qinweiVae 阅读数:817 标签: spring cloud 更多

个人分类: spring cloud

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sinat_38843093/article/details/79961283

无论你在 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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

早晚喝点它,逼出体内十年湿气,越喝越漂亮! 浩然川调 · 猎媒

  • dada111111111

    Damon-Da: 还有就是eureka.client.service-url.defaultZone 配置需要在该文件中,如果在application.yml中还是会报错(3个月前#1楼)

猜你喜欢

转载自blog.csdn.net/f45056231p/article/details/89249999