spring使用jackson返回object报错:Handler execution resulted in exception: Could not find acceptable representation

spring使用jackson返回object报错:Handler execution resulted in exception: Could not find acceptable representation,第1张

spring使用jackson返回object报错:Handler execution resulted in exception: Could not find acceptable representation

问题:在springmvc中添加Jackson jar包返回Object类型,处理器方法的produces属性不写,默认根据类型,但如果指定了(错误原因)produces = "text/html;charset=utf-8"就会报错

错误码: Handler execution resulted in exception: Could not find acceptable representation

正确配置:

@RequestMapping(value = "/jacksonMap.do", produces = "application/json;charset=utf-8")

 

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/589099.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-12
下一篇 2022-04-12

发表评论

登录后才能评论

评论列表(0条)

保存