报错: Content type 'text/plain;charset=UTF-8' not supported

@RequestMapping("test")
public Result test(@RequestBody ProtalQuery query) {
     ...
    return Result.success();
}

一开始使用对象方式接受数据,一直报错. 改成下面形式就好了!

@RequestMapping("test")
public Result test(@RequestBody String json) {
    ProtalQuery query = JSON.parseObject(json, ProtalQuery.class);
     ...
    return Result.success();
}

通过字符串接收,自己再解析一次.

相关文章:

  • 2022-01-16
  • 2021-06-15
  • 2021-08-30
  • 2022-12-23
  • 2021-05-29
猜你喜欢
  • 2021-06-19
  • 2022-12-23
  • 2021-10-21
  • 2021-08-31
  • 2022-12-23
  • 2021-10-12
  • 2021-08-26
相关资源
相似解决方案