I'm using Hibernate Validator with Spring to validate my entities, and I have the following bean that validates entities and throws a javax.validation.ConstraintViolationException in case something is invalid:
I'm using this method from a Service, and letting it all pass through the following class that handles the given exceptions, specially this one as you can see in the line provided:
Debugging that code, I can even see the above method being executed, with the right exception passed and everything, but instead of a 400 Bad Request and a nice array with the constraint violations, I'm getting a 500 Internal Server Error with the message: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is javax.validation.ConstraintViolationException.
And with that my unit tests results in an error.
As for the other exceptions that I created, like this one:
They're being handled just fine, and returns a 404 Not Found.
Can someone help me? I'm not using Spring Boot, just basic XML config app.
Aucun commentaire:
Enregistrer un commentaire