Announcement Announcement Module
Collapse
No announcement yet.
@Valid @RequestBody Does not work Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Valid @RequestBody Does not work

    Custom validator is not getting called with following configuration. I don't have <mvc:annotation-driven /> in my xml configuration file. Strange thing is, it gets called for someOtherObj which is being returned.

    Spring Framework 3.1.2
    Hibernate-Validator 4.3.1

    Controller
    --------
    @InitBinder
    protected void initBinder(WebDataBinder binder) {
    binder.setValidator(new CustomValidator());
    }

    public ModelAndView create(@Valid @RequestBody MyObject obj) throws Exception
    {
    return new ModelAndView("default", "xxx", someOtherObj);
    }
Working...
X