可能出现Request method ‘POST’ not supported或Request method ‘GET’ not supported报错常见的几种情形
第一种情况,Feign调用或其他请求方式与调用接口不同
//Feign
@FeignClient(value = "test-provider/test", configuration = FeignConfig.class)
public interface DcVarProviderFeign {
@GetMapping("/test")
Result test();
}
//实际接口
@PostMapping
public Object test() {
...
}
第二种情况,在进行Feign调用时,请求参数注解不同
//Feign
@FeignClient(value = "test-provider/test", configuration = FeignConfig.class)
public interface DcVarProviderFeign {
@PostMapping("/test")
Result test(@RequestParam("code") String code);
}
//实际接口
@PostMapping
public Object test(@RequestBody String code) {
...
}