SpringCloud-3-Eureka将消费者注册到Eureka

该博客介绍了如何在SpringCloud环境中创建一个服务消费者,并将其注册到Eureka服务发现中心。文章首先提及消费者需要引入Eureka依赖,然后创建一个Controller提供对外接口,通过`http://{应用服务名}/{服务方法映射地址}`格式调用服务。接着,文章讨论了客户端负载均衡的概念,以及消费者启动后在Eureka中看到服务实例已注册。最后,提到了使用Feign模块来优化服务调用的代码结构。
摘要由CSDN通过智能技术生成

基于上一篇文章已创建好服务发现和注册中心,并且提供了服务方法.现在我们新搞一个服消费者并将注册到Eureka.

消费者和服务者本身都作为Eureka客户端,所以配置上很相似

首页也是从POM开始,引入Eureka依赖

    <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
         <version>1.4.0.RELEASE</version>
     </parent>

    <dependencyManagement>
         <dependencies>
             <dependency>
                 <groupId>org.springframework.cloud</groupId>
                 <artifactId>spring-cloud-dependencies</artifactId>
                 <version>Camden.SR3</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
         </dependencies>
     </dependencyManagement>
 
     <dependencies>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-eureka</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-ribbon</artifactId>
         </dependency>
     </dependencies>
     
     <build>  
         <plugins>  
             <!-- define the project compile 
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值