就目前而言的话,微服务的之间的调用方式有两种:
第一种:Ribbon + restTemplate
public String consumer() {
return restTemplate.getForObject("http://eureka-client/dc", String.class);
}
第二种:Fegin
@FeignClient(value = "eureka-client")
public interface DcClientService {
@GetMapping("/dc")
String consumer();
}
还要注意一点其实Fegin中也使用了Ribbon!