Let us implement client-side load balancing by following these steps:
- First, create a Maven project ch10-eureka-client that contains pom.xml with SpringCloudFinchley dependencies. Just add the core starter POM such as webflux, the actuator and the following SpringCloudNetflixRibbon module dependencies:
<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>
- Then, create a typical bootstrap class suited for a Eureka client that fetches the registry and automatically registers itself to the Eureka server:
@SpringBootApplication @EnableDiscoveryClient ...