Consider not handling NoResourceFoundException in WebFlux #34236
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: waiting-for-triage
An issue we've not yet triaged or decided on
While working on
ProblemDetail
support for error views in Spring Boot (See spring-projects/spring-boot#19525), I have noticed that theorg.springframework.web.reactive.result.method.annotation.ResponseEntityExceptionHandler
handles allNoResourceFoundException
instances as Problem Detail JSON/XML responses.This exception is thrown for all 404s in the application, meaning that a browser requesting a missing page will always get a JSON response.
In the current error handling support for Spring Boot, the application can contribute an
ErrorWebExceptionHandler
which can render errors as JSON payloads or HTML views. Because it is ordered after theResponseEntityExceptionHandler
, there is no chance for Spring Boot to render HTML error pages for 404s.I don't think there is a way to really understand the intent of the client here in Spring Framework. Spring Boot does that by checking that the client requests "text/html" explicitly.
This is an important change to consider in 6.2.x, but I'm wondering how we can unlock this use case for Spring Boot. Isn't handling
The text was updated successfully, but these errors were encountered: