Closed bclozel closed 1 year ago
Are there plans to make application/problem+json
the default format for error responses in the future? I think something based on standards is always a more suitable default vs something non-standard.
However, it seems that such a change wouldn't be considered until 4.0 which is I assume years away.
Could you still consider changing the default for 3.0? It is a major release after all, and flipping one configuration property to restore previous behavior doesn't seem like a big deal.
There are no plans currently for this. The Problem Details support is completely new, and this also changes the response format. We would also probably need to deprecate/remove existing infrastructure such as ErrorController
and ErrorAttributes
. The current problem details feature supports internationalization, but HTML view rendering is not (like with Boot's error handling).
We're definitely considering this option and we will probably gradually improve and replace things during the 3.x timeline. We definitely need more feedback on this.
As of spring-projects/spring-framework#27052, Spring Framework provides support for the "Problem Details" RFC 7807. This is supported for both Spring MVC and Spring WebFlux, backed by
ResponseEntityExceptionHandler
.We should introduce configuration properties (
spring.mvc.problemdetails.enabled
andspring.webflux.problemdetails.enabled
) that contribute customResponseEntityExceptionHandler
instances (annotated with@ControllerAdvice
) so thatProblemDetail
and related exceptions are handled properly and serialized asapplication/problem+json
.We should ensure that:
false
by default, as this could be a breaking change for applicationsResponseEntityExceptionHandler
is already present in the context