<mvc:annotation-driven />的缺失导致:
当请求:
@RequestMapping("json1")
public @ResponseBody UserType json1(Model model){
return userTypeService.getById(6);
}
将会提示:
然而当请求:
@RequestMapping(value="json",method=RequestMethod.GET)
public @ResponseBody String json(Model model){
return "this is a string";
}
却是没有任何问题的:
对于这种现象,我也不知何原因!
Spring mvc 操作json的话,别忘记了 " jackson-all-1.8.5.jar "