springcloud config-client启动报错:java.lang.IllegalStateException: No instances found of config server

如题

在这里插入图片描述

解决

config-server端 application.yml文件中配置过注册eureka:

server:
  port: 8888
spring:
  application:
    name: configserver
  cloud:
    config:
      server:
        git:   # git仓库配置文件信息
          uri: https://github.com/xxx/springclouddemo.git   # git仓库地址
          searchPaths: config  # 配置文件路径
#          default-label: master # git仓库的分支
          skip-ssl-validation: true  # 跳过ssl验证
      label: master
#eureka:
#  client:
#    serviceUrl:
#      defaultZone: http://localhost:8761/eureka/

但是不管用。看其他博主的博客解决办法试过了也不行,如name、server名不对应之类的;启动顺序不对…

我这里原因是config-server端并没有添加pom.xml依赖:

<dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

所以总是注册不到eureka server上。

另外config -server的Main主类上添加注解:

@SpringBootApplication
@EnableConfigServer
@EnableEurekaClient

在这里插入图片描述

over~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值