SpringMVC only intercepts the mapping path, but not the non-mapping path, how to intercept the non-mapping path?

I want to make a 404 page. If users type messy URL, they will jump to 404, but Springmvc will not intercept paths without mapping, and then jump directly to Tomcat 404, but it is impossible for users to see Tomcat 404. So is there any good solution


students, take a look at Spring document . Basically, there are official solutions. If it is really difficult for English, right click to translate into Chinese

.

you can also use SimpleMappingExceptionResolver to capture NoHandlerFoundException try


spring,web.xml,listener,interceptor can handle

Menu