在启动上面加一个注解(@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; }