belgif / rest-problem-java

Java library for RFC 9457 Problems with support for standard problem types of the Belgif REST guide (https://www.belgif.be/specification/rest/api-guide/#error-handling)
https://belgif.github.io/rest-problem-java/
Apache License 2.0
3 stars 0 forks source link

[spring] Map NoResourceFoundException #72

Closed pvdbosch closed 2 months ago

pvdbosch commented 2 months ago

When navigating to a URL that isn't mapped to a RestController, a NoResourceFoundException is thrown.

This exception currently results in a internalServerError problem type (default mapping); but should be a 404 resourceNotFound one.

jpraet commented 2 months ago

I observed that with the integration tests too:

https://github.com/belgif/rest-problem-java/blob/4c893ad28475a2335b7e9faf51c3f357abc8fda6/belgif-rest-problem-it/belgif-rest-problem-spring-boot-3-it/src/test/java/io/github/belgif/rest/problem/RestProblemSpringBoot3IT.java#L29-L33

The NoResourceFoundException is new in Spring Boot 3.2 / Spring Framework 6.1 though. We may need to add a separate module for Spring Boot 3.x then, or drop support for 2.x.

pvdbosch commented 2 months ago

Yeah, I don't see a simple way to add it without forking the module for 3.x or dropping 2.x support. Spring Boot 2 support is for us not really important, its open-source version is already EOL and projects should migrate to 3.x.