1

Sifting through forums I can't seem to stumble into an issue solution I've been haveing with Spring Boot + JPA and JSR303 bean validation.

Simply put validation works but but when say

org.springframework.web.bind.MethodArgumentNotValidException

is thrown and then the output a consumer gets (from a rest controller) is something like this:

"timestamp": 1427658793929,
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.web.bind.MethodArgumentNotValidException",
"message": "Validation failed for argument at index 1 in method: public org.springframework.http.HttpEntity<org.springframework.hateoas.Resource<org.home.project.UserInfo>>... {omitted for brevity}

This is overkill verbosity - can I intercept this to make the "message:" part of JSON more formatted and user friendly (e.g.) produce a simple list saying:

>  - "messages:" { "firstName can not be Empty or Null or has to be at least 8 characters", 
"lastName is a swear word...", ... }
2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.