Feign客户端的使用方法详解

2022年6月3日13:27:14
在启动上面加一个注解(@EnableFeignClients)

@FeignClient("APP-MEMBER")    //调用服务名称
public interface TestFeignController {

    @RequestMapping("/test")  //调用接口的地址(APP-MEMBER该服务下的接口地址)
    public String getTest();
}

//另起一个类,用于调用接口
@Autowired
private TestFeignController testFeign;
@RequestMapping("/getFeign")
public String getTest() {

    String result = testFeign.getTest();
    result = "订单服务调用会员服务result:" + result;
    return result;
}
  • 作者:csdn-熊
  • 原文链接:https://blog.csdn.net/weixin_42193081/article/details/84203566
    更新时间:2022年6月3日13:27:14 ,共 368 字。