出现这种情况有三种可能
1、缺少maven依赖关系或者jar包:jackson-annotations.jar,jackson-core.jar,jackson-databind.jar 这三个包版本不能低于1.9.3,否则会报406.最好是2.0以上的。本人就是架包版本低了,低级错误不能犯啊。
2、spring-mvc.xml中
把
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
3、controller中方法没有配置@ResponseBody