有没有办法在不使用 Hibernate的情况下自动验证 Spring 3.0 中的传入模型?我有一个实现 Validator 接口的 CustomValidator,我希望为我指定的每个方法调用该 CustomValidator,例如:
@Controller
@RequestMapping("/*")
public class MyController {
@RequestMapping(value = "/edit/{entryId}", method = RequestMethod.POST)
protected String editEntry(@PathVariable int entryId, Guestbook guestbook) {
// Validate Guestbook against CustomValidator
}
}