Add custom-validation, etag-caching, restclient-basic-auth: Boot 4.1 API pass
Three companion modules verifying and rewriting the Boot 4.1.1 / Framework 7.0.9 story for three older articles: the javax->jakarta.validation namespace fix plus Jakarta Validation 3.1 record-validation clarification, ETag/ conditional-request APIs re-verified unchanged plus the starter rename, and RestTemplate Basic Auth rebuilt on RestClient with the exchange() trap called out. 19 real passing tests generate every transcript quoted from the three companion articles. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EQNA6DJ9VgCtW6zhCE8Xud
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# 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":"[email protected]","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.
|
||||
Reference in New Issue
Block a user