解决方案:RequestMappingHandlerMapping中重写handleNoMatch方法,springMVC和springboot中配置无区别。
另:
1、可搭配advice处理抛出的异常;
2、可在HttpServletRequest中通过setAttribute、getAttribute记录/读取状态。
MVC路径无匹配或请求api版本过低时处理
原文:https://www.cnblogs.com/feixuefubing/p/9395271.html