当前位置: 代码迷 >> 综合 >> Spring Cloud 学习(七)——使用DiscoveryClient模拟负载均衡操作
  详细解决方案

Spring Cloud 学习(七)——使用DiscoveryClient模拟负载均衡操作

热度:31   发布时间:2023-12-15 21:05:24.0

一、测试前的准备

1、创建eureka注册中心

2、创建端口为8001的member子模块和端口为8000的member子模块,分别注册到指定的注册中心上

二、创建服务的消费者

1、引入依赖

<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.0.2.RELEASE</version></parent><!-- 管理依赖 --><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Finchley.M7</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><dependencies><!-- SpringBoot整合Web组件 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dep
  相关解决方案