OpenFeign 远程调用第三方api
1、区别
远程调用客户端的注解,vale 名称, url 第三方api的域名(http://ip+port)
@FeignClient(value = "word", url = "http://res.abeim.cn/")
2、案例
访问: http://res.abeim.cn/api-text_sweet
@FeignClient(value = "word", url = "http://res.abeim.cn/") public interface WordFeignClient { @GetMapping("/api-text_sweet") String getSweetText(); }
组件注入
3、使用
@Autowired private WordFeignClient wordFeignClient;
4、注意
调用业务api是客户端负载均衡,调用第三方api是第三方服务端负载均衡