九、Spring Cloud Config Server详解(七):Config整合Eureka

本文详细介绍了如何将Spring Cloud Config Server和Config Client整合到Eureka服务发现中。首先创建了两个项目,分别为Config Client和Config Server,并在两者中引入Eureka客户端依赖。接着,配置了Config Client的bootstrap.yml和application.yml,确保其能正确注册到Eureka。Config Server的配置文件同样关键,包括启用@EnableConfigServer和@EnableEurekaClient。最后,通过启动各服务并访问特定URL,验证了Config Client能够通过Eureka找到并连接Config Server获取配置信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

9.8.Config整合Eureka


Config 整合Eureka,是需要将Config Server和Config Client都整合到Eureka,然后Config Client通过服务发现,找到Config Server,从而连接Config Server,获取配置信息。


1、创建两个项目:
futurecloud-config-client-eureka
futurecloud-config-server-eureka
分别是Config Client和Config Server。两个项目都引入eureka的客户端依赖


futurecloud-config-client-eureka项目的依赖如下:

 <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--Spring Cloud Config 客户端依赖-->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-config</artifactId>
    <version>2.0.0.RELEASE</version>
</dependency>
<!--Spring Boot Actuator ,监控服务端变化-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!--添加eureka 客户端依赖-->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    <version>2.0.2.RELEASE</version>
</dependency>

futurecloud-config-server-eureka项目的依赖如下:

 <dependency>
    <groupId&g
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值