使用spring cloud config报错Fetching config from server at : http://localhost:8888

折月煮酒 提交于 2020-01-07 11:28:07

使用spring cloud的config配置中心时在使用这个配置的文件中配置了请求路径但是没生效如:

#application.ymlspring:
  cloud:
    config:
      discovery:
        enabled: true
        service-id: config-server
      name: user-service
      profile: dev
      uri: http://localhost:6001
eureka:
  client:
    service-url:
      defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
2020-01-07 10:21:37.305  INFO 4816 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
2020-01-07 10:21:38.393  INFO 4816 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://localhost:8888. Will be trying the next url if available
2020-01-07 10:21:38.394  WARN 4816 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/user-service/dev": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2020-01-07 10:21:38.395  INFO 4816 --- [           main] cn.tedu.sp03.Sp03UserserviceApplication  : No active profile set, falling back to default profiles: default
2020-01-07 10:21:38.975  WARN 4816 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.

  我在这儿申明了路径是http://localhost:6001 但是还是访问的http://localhost:8888,也就是说明配置未生效,这时只需要将配置文件的名字修改为bootstrap.yml即可,这个文件的加载优先级高于application.yml;

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!