緣由spring3跟spring4的jackson不同。spring
解決方案:json
1)spring3.x是org.springframework.http.converter.json.MappingJacksonHttpMessageConverterapp
spring4.x是org.springframework.http.converter.json.MappingJackson2HttpMessageConverterspa
2)添加依賴的包。xml
<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>io