Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported for @RequestBody XXX

问题描述

前端使用ajax发送post请求发送Json数据,spring mvc报Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported for @RequestBody  XXX错误

 解决办法

1.重新组装数据
var params=JSON.stringify({param1:param1});

2.ajax请求设置
dataType: "json",
data: param,
contentType: "application/json;charset-UTF-8"

  

原文地址:https://www.cnblogs.com/mufire/p/9534268.html