这个问题害了我弄了几天才弄好,后来开了http://www.tuicool.com/articles/FJnmAvY

这篇文章才算把问题解决了。


首先将spring的bean文件头文件改一下

改成


<?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  

      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  

      http://www.springframework.org/schema/context  

      http://www.springframework.org/schema/context/spring-context-3.0.xsd  

      http://www.springframework.org/schema/aop  

      http://www.springframework.org/schema/aop/spring-aop-3.0.xsd  

      http://www.springframework.org/schema/tx   

      http://www.springframework.org/schema/tx/spring-tx-3.0.xsd  

     http://www.springframework.org/schema/mvc   

     http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">


也就是把以前spring-mvc-3.0.xsd 升级到  spring-mvc-3.2.xsd,如果已经是 spring-mvc-3.2.xsd的就不用改了


然后把<mvc:annotation-driven>修改成如下格式

<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" />   

  <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">   

    <property name="favorPathExtension" value="false" />  

    <property name="favorParameter" value="false" />   

    <property name="ignoreAcceptHeader" value="false" />   

    <property name="mediaTypes" >   

      <value>  

        atom=application/atom+xml  

        html=text/html  

        json=application/json  

        *=*/*  

      </value>   

    </property>  

  </bean>


jackson的包就引用

jackson-core-2.5.2.jar

jackson-annotations-2.5.2.jar

jackson-databind-2.5.2.jar

这三个包就可以了