Feign
- 声明式REST客户端(伪RPC)
- 采用基础接口的注解
- 使用ribbon做负载均衡
/**
* 访问接口
*/
@FeignClient(name = "client") // application.name
public interface ClientService {
@GetMapping("home/hello")
String helloClient();
}
@Autowired
private ClientService clientService;
@GetMapping("/helloFeign")
public String helloFeign() {
String result = clientService.helloClient();
return result;
}