I’m getting na exception on the following method:
@Transactional
@RequestMapping(method=RequestMethod.PUT)
public @ResponseBody Account create(@Valid @RequestBody CreateAccountRequest request, BindingResult bindingResult)
{ ...
}
Throws the following exception:
java.lang.IllegalStateException: An Errors/BindingResult argument is
expected to be immediately after the model attribute argument in the
controller method signature: public
com.mangofactory.concorde.domain.Account
com.mangofactory.concorde.api.AccountService.create(com.mangofactory.concorde.api.rpc.CreateAccountRequest,org.springframework.validation.BindingResult)
According to the documentation, I’m required to add a BindingResult as the second parameter. However, I’ve done that.
It’s even present in the exception.
What have I missed?
Turns out that the way to solve this was to remove the
BindingResultproperty completely.The signature that worked was:
This was as tipped by point #3 on this blog post.