[Solved] Spring Cloud Use Ribbon Error: No instances available for XXX

Question

After configuring load balancing, start springboot and report an error

reason

The version difference of jar
I first used ribbon and Eureka. When I added them, I didn’t notice that the following two versions were abandoned

<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-ribbon -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-ribbon</artifactId>
    <version>1.4.7.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-eureka -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-eureka</artifactId>
    <version>1.4.7.RELEASE</version>
</dependency>

Solution:

The dependency of replacing the Eureka registry module is

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
            <version>3.0.4</version>
        </dependency>

The dependency of replacing the service provider and consumer modules is
the ribbon required by the consumer module has been built-in compatible with the latest version of Eureka

         <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
            <version>3.0.4</version>
        </dependency>

Read More: