参考:
http://stackoverflow.com/questions/28364564/how-to-catch-spring-pagenotfound-exception-in-dispatcherservlet-context-without
Actually I found the exact solution by diagnosing DispatcherServlet sources. We need to specify init-param for dispatcher servlet:
<init-param><param-name>throwExceptionIfNoHandlerFound</param-name><param-value>true</param-value></init-param>
So, 404 is very specific case.
本文介绍了一种解决 Spring 框架中 404 错误的具体方法。通过设置 DispatcherServlet 的 init-param 参数 throwExceptionIfNoHandlerFound 为 true,可以有效地捕获未找到处理器的情况。
635

被折叠的 条评论
为什么被折叠?



