项目运行找不到服务

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();
}
posted @ 2020-06-28 17:49  九鼎很难顶  阅读(50)  评论(0编辑  收藏  举报