代码如下:
@FeignClient(name = "eureka-client", fallbackFactory = FallBack.class, decode404 = true, path = "/client")
public interface FeignApi {
// @PostMapping("/hello/{who}")
// String hello(@PathVariable(value = "who") String who) throws Exception;
@GetMapping("/hello")
String hello(Params params) throws Exception;
}
调用报错:
feign.FeignException: status 405 reading FeignApi#hello(Params)
解决办法:
改用post请求,添加@RequestBodey注解
新增@SpringQueryMaq注解,如下:
@GetMapping("/hello")
String hello(@SpringQueryMap Params params) throws Exception;