problem-details-rfc9457

Solid

Use when implementing error handling, exception mappers, or error response formatting. Enforces RFC 9457 (Problem Details for HTTP APIs) using Spring's built-in ProblemDetail.

AI & Automation 225 stars 37 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
78
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Problem Details — RFC 9457 Spring Boot 4.x includes native RFC 9457 support via `ProblemDetail` on Spring Framework 7. ## Enable in application.yml ```yaml spring: mvc: problemdetails: enabled: true # enables Spring's built-in RFC 9457 handler ``` ## ProblemDetail Response Shape ```json { "type": "https://api.example.com/errors/order-not-found", "title": "Order Not Found", "status": 404, "detail": "No order found with id: 550e8400-e29b-41d4-a716-446655440000", "instance": "/api/v1/orders/550e8400-e29b-41d4-a716-446655440000", "errorCode": "ORDER_NOT_FOUND", "timestamp": "2026-04-13T10:00:00Z" } ``` ## Global Exception Handler ```java @RestControllerAdvice public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(EntityNotFoundException.class) public ProblemDetail handleNotFound(EntityNotFoundException ex, HttpServletRequest request) { ProblemDetail problem = ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, ex.getMessage()); problem.setType(URI.create("https://api.example.com/errors/not-found")); problem.setTitle("Resource Not Found"); problem.setInstance(URI.create(request.getRequestURI())); problem.setProperty("errorCode", "NOT_FOUND"); problem.setProperty("timestamp", Instant.now()); return problem; } @ExceptionHandler(BusinessRuleViolationException.class) public ProblemDetail handleBusinessRule(BusinessRuleViolationExc...

Details

Author
rrezartprebreza
Repository
rrezartprebreza/spring-boot-skills
Created
4 months ago
Last Updated
6 days ago
Language
Java
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category