我真萌新 2021-12-25 19:59 采纳率: 0%
浏览 4650

feign.codec.EncodeException Error converting request body

问题遇到的现象和发生背景

在springcloud忠使用了postmapping进行传递实体类参数

问题相关代码,请勿粘贴截图
运行结果及报错内容

img

img

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-12-25 19:45:30.016 ERROR [consumer,,] 40216 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'assetBorrowController': Unsatisfied dependency expressed through field 'assetBorrowClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webConsumer.client.AssetBorrowClient': Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: Method AssetBorrowClient#assetReturn(AssetBorrow,String) not annotated with HTTP method type (ex. GET, POST)
Warnings:

  • Class AssetBorrowClient has annotations [FeignClient, RequestMapping] that are not used by contract Default
  • Method assetReturn has an annotation PutMapping that is not used by contract Default
    我的解答思路和尝试过的方法
    我尝试过三个不同的注解
    requestmapping
    postmapping
    requestline
    都不能解决传参问题
    参数格式为自定义的实体类
    前端以json格式进行传参
    我想要达到的结果
    能够使得消费者端数据成功传递到服务端
    数据格式为json
  • 写回答

2条回答 默认 最新

  • 我真萌新 2021-12-27 09:50
    关注

    img

    评论

报告相同问题?

问题事件

  • 创建了问题 12月25日