Description
When RFC 9457 support is enabled via spring.mvc.problemdetails.enabled=true, there is an inconsistency in error response formats.
While exceptions handled by the Spring MVC infrastructure (via ResponseEntityExceptionHandler) correctly return the standard application/problem+json format, the error responses generated by BasicErrorController#error(HttpServletRequest) or DefaultErrorAttributes still return the legacy Spring Boot error format.
Observed Behavior
ResponseEntityExceptionHandler returns RFC 9457 format:
{
"type": "about:blank",
"title": "Bad Request",
"status": 400,
"detail": "Invalid input",
"instance": "/api/resource"
}
BasicErrorController always returns the legacy format:
{
"timestamp": "2023-10-27T10:00:00.000+00:00",
"status": 404,
"error": "Not Found",
"path": "/api/non-existent"
}
Expected Behavior
When spring.mvc.problemdetails.enabled is set to true, the BasicErrorController (or DefaultErrorAttributes) should also produce a response body that adheres to the RFC 9457 Problem Details specification?
Are there plans to update BasicErrorController to natively support spring.mvc.problemdetails.enabled?