See https://github.com/spring-projects/spring-framework/issues/31569#issuecomment-1825493324 for background

Comment From: rstoyanchev

Prior to RFC 7807, we didn't have an opinion on the format of an error response, and provided an abstract ResponseEntityExceptionHandler that leaves it to sub-classes to choose the error details format. Boot added such an opinion, but its error handling was only meant as a fallback for unresolved exceptions.

In 6.0 we added support for RFC 7807 and that allows ResponseEntityExceptionHandler to handle all exceptions with error details rather than leaving them to Boot's error handling.

In 6.1 with #29491 and #30930 we also started handling static resource exceptions, but ResponseEntityExceptionHandler, but that doesn't support HTML error responses as reported in #31569.

We need an equivalent of ResponseEntityExceptionHandler that supports browser requests, but there is currently no good way to create @ExceptionHandler variants with ResponseEntity vs ModelAndView return values, based on the requested content type. That's something Boot's error handling supports but using @RequestMapping methods on an ERROR dispatch.

We should consider some content negotiation mechanism for @ExceptionHandler methods. The equivalent of the produces attribute on @RequestMapping.