问题:前端传json,后端也返回json,出现格式不匹配报415问题!!!!

 

1.maven引入jackson包,共3个【重要】[实用!]SpringMVC与微信小程序JSON交互时 @RequestBody,415Unsupported Media Type错误 微信小程序

获得 jackson-annotation jar包的教程如下

https://www.cnblogs.com/dlsunf/p/9855195.html

 

2.springmvc的配置文件【重要】

[实用!]SpringMVC与微信小程序JSON交互时 @RequestBody,415Unsupported Media Type错误 微信小程序


4.前端(微信小程序Ajax)【重要】
最好在headers中限制一下传输和接收的内容格式

[实用!]SpringMVC与微信小程序JSON交互时 @RequestBody,415Unsupported Media Type错误 微信小程序


5.后端【很简单】

[实用!]SpringMVC与微信小程序JSON交互时 @RequestBody,415Unsupported Media Type错误 微信小程序
下面是业务代码,所以没截图了


maven引入jackson包后

大工造成了!!

[实用!]SpringMVC与微信小程序JSON交互时 @RequestBody,415Unsupported Media Type错误 微信小程序[实用!]SpringMVC与微信小程序JSON交互时 @RequestBody,415Unsupported Media Type错误 微信小程序

相关文章:

  • 2021-09-26
  • 2022-02-09
  • 2021-12-25
  • 2022-12-23
  • 2021-05-26
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-20
  • 2021-08-20
  • 2022-12-23
  • 2021-12-19
  • 2021-08-25
  • 2021-12-24
  • 2021-11-07
相关资源
相似解决方案