[BUG] feign.FeignException$MethodNotAllowed: status 405 reading

下面展示 bug

feign.FeignException$MethodNotAllowed: status 405 reading PaymentService#cre

客户端

    @RequestMapping(value = "create",method = RequestMethod.POST)
     CommentResult create(@RequestBody Payment payment);

业务端

 @RequestMapping(value = "create",method = RequestMethod.POST)
    public CommentResult create(@RequestBody Payment payment){
        int i = paymentService.create(payment);
        if(i>0)
        return new CommentResult(200,"插入成功",payment);
        else return new CommentResult(400,"插入失败",i);
    }

错误原因

使用@RequestBody传输json数据只能使用POST

错误二

Feign PathVariable annotation was empty on param 0.

使用Feign的时候,如果参数中带有@PathVariable形式的参数,则要用value=""标明对应的参数,否则会抛出IllegalStateException异常

你可能感兴趣的:(笔记)