(1)导入解析json的包
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.66</version>
</dependency>
(2)配置bean
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"></bean>
(3)解析 json
(@RequestBody请求的数据是json,才会去解析
@RequestMapping("/json")
public User getUser(@RequestBody User user){
System.out.println(user);
user.setId(2222);
user.setName("韩聪颖");
return user;
}