1.@GetMapping 不支持
必须用@RequestMapping
2.@PathVariable 必须设置value
3.如果是get方法,但是参数是个对象(比如 public User getUser(User user)),feign会把它当做post方法。所以这里我们必须把User的属性都一个一个@RequestParam("id")String id出来
4. GET请求多参数的URL
尽管指定了GET方法,Feign依然会发送POST请求。解决办法
@FeignClient(name = "microservice-provider-user")
public interface UserFeignClient {
@RequestMapping(value = "/get", method = RequestMethod.GET)
public User get1(@RequestParam("id") Long id, @RequestParam("username") String username);
}
5. POST请求包含多个参数
@FeignClient(name = "microservice-provider-user")
public interface UserFeignClient {
@RequestMapping(value = "/post", method = RequestMethod.POST)
public User post(@RequestBody User user);
}