# application.yaml: spring.mvc.problemdetails.enabled: true (opt-in; unrelated to Bean # Validation 3.1 itself -- this property already existed in Boot 3) $ curl -s -X POST localhost:8080/contact-record \ -H 'Content-Type: application/json' \ -d '{"email":"spammy@email.com","message":"This is spam."}' HTTP status: 400 Content-Type: application/problem+json Body: {"detail":"Invalid request content.","instance":"/contact-record","status":400,"title":"Bad Request"} # Progress over the empty body, but notice what is MISSING: no mention of "spam", no field # name. Boot's default MethodArgumentNotValidException -> ProblemDetail mapping fills in # only the generic RFC 9457 fields (title, status, detail="Invalid request content."). # Per-field messages -- what the class-based /contact endpoint hand-rolls from # bindingResult.getFieldErrors() -- need a custom @ExceptionHandler that does the same # thing into the ProblemDetail's own "properties" map. Turning the property on is not, # by itself, a drop-in replacement for BindingResult-based error reporting.