项目运行找不到服务

I/O error on GET request for "http://LEYOU-TIME-SERVER/getTime": LEYOU-TIME-SERVER; nested exception is java.net.UnknownHostException: LEYOU-TIME-SERVER

@LoadBalanced  //启用负载均衡机制,这样频繁用到的对象会存储在内存中?
    @Bean
    //RestTemplate 用来发送http请求
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

发现在application类中加上启用负载均衡 @LoadBalanced 注解即可;

@LoadBalanced  //启用负载均衡机制,这样频繁用到的对象会存储在内存中?
@Bean
//RestTemplate 用来发送http请求
public RestTemplate restTemplate(){
return new RestTemplate();
}
原文地址:https://www.cnblogs.com/zwwang/p/13204249.html