Relative Content

Tag Archive for javaspring-boottomcaterror-handlingspring-boot-3

How to override default Tomcat 404 not found html page in Spring Boot 3.2?

I’m working on a Spring Boot 3.2 application and have set a custom context path (/api). I want to replace the default HTML error responses from Tomcat with JSON responses, especially for 404 errors. However, I am encountering difficulties handling 404 errors that occur outside of the context path.