春天休息?

时间:2010-12-04 16:09:07

标签: java spring rest restful-url

@ModelAttribute("user")
@RequestMapping(value = "/", method = RequestMethod.POST)
public User saveUser( @RequestBody User user ) throws IOException {
        logger.debug(user);
        return user;
}

requestbody会将json转换为bean(pojo),在这种情况下是否需要使用注释@ModelAttribute(“user”)?

1 个答案:

答案 0 :(得分:1)

在这种情况下不需要@ModelAttribute。有关此主题的更多信息,请参阅Keith Donald的博客:Ajax Simplifications in Spring 3.0