《SpringCloud.H心法总纲》 html
继续上一篇,接下来Springcloud配置Config Server 和 Config Client 都服务化。spring
两个子模块都添加eureka-client依赖bootstrap
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency>
两个子模块都添加去注册eureka-server的地址spa
bootstrap.properties.net
# config-server 默认30秒主动向注册中心发送一次心态 eureka.instance.lease-renewal-interval-in-seconds=10 # config-server 须要去注册的地址,也就是eureka-server的地址+/eureka的后缀 eureka.client.serviceUrl.defaultZone=http://localhost:8070/eureka/
两个子模块在启动类都要添加server
@EnableEurekaClient
分别启动eureka-server,config-server,config-client,如图:htm
继续调用 http://localhost:8074/test1.html,结果:blog
因而可知,Springcloud项目的任何一个模块,都必须依赖的是eureka-client和config-client。get