I have a controller which makes post method. The controller's method validates a entity. In case some errors occurred it redirects to error page otherwise it saves the entity. My code looks like that:
public String createEntity(Entity entity, BindingResult result) {
// Validate here
if(result.hasErrors) {
return "errorPage";
}
service.create(entity);
return "some view";
}
So now if there are errors I want to log them all. I've read this article
How to get error text in controller from BindingResult
but I don't want to type check.
Is there a clever way to do that?
Thank you.