Advertisement

Spring Boot 小白之 JPA @Post请求插入异常的几种情况

阅读量:

文章目录

  • Content-Type 'application/x-www-form-urlencoded;charset=UTF-8' does not accept application/x-www-form-urlencoded.
    • 报错背景: 错误原因

    • 问题解决: 问题得到解决

    • 插入的数据为空值

      • 背景
      • 问题解决
    • org.hibernate.TransientObjectException

      • 背景
      • 问题解决
    • Controller返回值问题

      • 问题解决

The Content-Type 'application/x-www-form-urlencodedcharset=UTF-8' does not accept submissions.

报错背景

  1. 该Controller接收了@RequestBody字段。
  2. 此次发起请求时使用了x-www-form-urlencoded格式的数据。

问题解决

不改变传入表单类型的前提下删掉@RequestBody

类似问题只要检查这两个位置的类型是否对应

Controller API
@RequestBody JSON Body
~~@RequestBod

全部评论 (0)

还没有任何评论哟~