SpringMVC使用@ResponseBody直接返回json对象报HTTP Status 406 – Not Acceptable错误

SpringMVC中使用@ResponseBody返回对象,出现406
The target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request, and the server is unwilling to supply a default representation.错误
解决办法是在springmvc的配置文件中加入:



这样就解决了。

你可能感兴趣的:(SpringMVC)