the server responded with a status of 415问题

主要是前端 contentType"application/json;charset=UTF-8";“application/x-www-form-urlencoded” 写了传入类型问题

后端和前端接受的类型必须一致。
前端是"application/json;charset=UTF-8" 后端是"application/json;charset=UTF-8",最好顺序保持一致
前端是"application/x-www-form-urlencoded" ,后端是"application/x-www-form-urlencoded"
后端接受 @RequestMapping(value = “/crateItem”,method = {RequestMethod.POST},consumes = {CONTENT_TYPE_FORMED})//
CONTENT_TYPE_FORMED = “application/json;charset=UTF-8” 或"application/x-www-form-urlencoded"

前端的contentType 和后端的consumes 必须是一致的

你可能感兴趣的:(JSON)