原因spring3跟spring4的jackson不一样。

  解决方案:

  1)spring3.x是org.springframework.http.converter.json.MappingJacksonHttpMessageConverter

  spring4.x是org.springframework.http.converter.json.MappingJackson2HttpMessageConverter

  2)添加依赖的包。

  <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>2.8.5</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>2.8.5</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>2.8.5</version>
            </dependency>

  

04-01 22:03