Ribbon做负载均衡java.lang.IllegalStateException: No instances available XXX

  1. 首先确认微服务名称,又说是因为不能带下环线,我的不是这个问题

    

spring:
  application:
    name: XXXX
2.确认添加@LoadBalanced注解来实现负载均衡
@Configuration
public class ConfigBean {

    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}

3.确认调用的名称正确

4.这是我的问题,是yml配置问题

server:
  port: 80
spring:
  application:
    name: consume80
eureka:
  client:
    service-url:
      defaultZone: http://eureka7001:7001/eureka/

错误配置:

server:
  port: 80
spring:
  application:
    name: consume80
eureka:
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone: http://eureka7001:7001/eureka/

第四种情况是我本地出现的问题

你可能感兴趣的:(spring,cloud)