springmvc获取json Failed to load resource: the server responded with a status of 406 (Not Acceptable)

来源:互联网 发布:喜马拉雅电台 知乎 编辑:程序博客网 时间:2024/06/11 04:59

使用springmvc3.1版本时通过@ResponseBody标签返回JSON数据的方法都报406错: Failed to load resource: the server responded with a status of 406 (Not Acceptable)  经过调试发现少了jackson-core-asl和jackson-mapper-asl两jar包,导入了1.9版本的jar后,问题解决了。


在解决上面问题的时候,顺便在网上发现Spring 3.2版本的BUG:Spring 3.2.x通过@ResponseBody标签返回JSON数据的方法都报406错,该错误不是jar包没导入的问题,而是spring3.2的bug,因为spring 3.2的requestedMediaTypes为[text/html]的情况导致报406错误,而3.1的requestedMediaTypes为[*/*]

0 0