原文地址:https://blog.csdn.net/iechenyb/article/details/80431676
如下定义了一个错误的get请求方法
public class HelloDao {
@RequestMapping(value="/hello",method= RequestMethod.GET)
public String sayHello(Integer id);
}
如果feign代理的是get请求,则每个参数必须带上@RequestParam,否则会报post not support!
服务端写法如下:
@RestController
public class HelloController {
@RequestMapping(value="/hello",method= RequestMethod.GET)
public String sayHello(@RequestParam("id") Integer id){
return "id:"+id;
}
}
正确的调用方法如下
@FeignClient("xxxxx")
public class HelloDao {
@RequestMapping(value="/hello",method= RequestMethod.GET)
public String sayHello(@RequestParam("id") Integer id);
}