如题
解决
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~