标签:alt blog tps method res 包名 span exce 异常
继承HandlerExceptionResolver接口实现自己的处理方法,如:
public class MyHandlerExceptionResolver implements HandlerExceptionResolver { @Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { //添加自己的异常处理逻辑,如日志记录等 // TODO Auto-generated method stub return new ModelAndView("exception"); } }
然后在项目的配置文件中添加:
<bean id="exceptionResolver" class="所在包名.MyHandlerExceptionResolver"/>
标签:alt blog tps method res 包名 span exce 异常
原文地址:http://www.cnblogs.com/sddychj/p/6794561.html