@RequestMapping 方法启动后是否可以运行@Validated?原因是我需要在实际验证之前修改@ModelAttribute。
理想情况下是这样的。
@RequestMapping(value = "/doSomething",
method = RequestMethod.POST)
public final String DoSomething(
@ModelAttribute(value = "myobject") final MyObject myobject) {
//.... do some processing on myobject
//.... now validate
BindingResult bindingResult = validate(myobject);
//...
还有这样的方法
private final BindingResult validate(
@Validated(value = {Group1.class, Group2.class}) MyObject myobject) {
return bindingResult //somehow return a BindingResult
}