springcloud添加LoadBalanced注解后报错:No instances available for localhost

1.问题描述
在RestTemplate添加@LoadBalanced注解后运行报错
springcloud添加LoadBalanced注解后报错:No instances available for localhost
springcloud添加LoadBalanced注解后报错:No instances available for localhost

java.lang.IllegalStateException: No instances available for localhost
	at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:119) ~[spring-cloud-netflix-ribbon-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:99) ~[spring-cloud-netflix-ribbon-2.2.5.RELEASE.jar:2.2.5.RELEASE]
	at org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor.intercept(LoadBalancerInterceptor.java:58) ~[spring-cloud-commons-2.2.5.RELEASE.jar:2.2.5.RELEASE]

2.问题解决
添加@LoadBalanced注解后,请求时需将请求的地址改成服务名称
springcloud添加LoadBalanced注解后报错:No instances available for localhost

3.测试结果
springcloud添加LoadBalanced注解后报错:No instances available for localhost

4.文章参考链接
a. https://songzixian.com/springcloud/449.html

上一篇:pip问题:WARNING: You are using pip version 19.2.3, however version 21.0.1 is available.


下一篇:关于torch.cuda.is_available()一直返回False的解决办法