当前位置:网站首页>8.1.3 handling global exceptions through exceptionhandler (Global exception handling) - SSM in depth analysis and project practice

8.1.3 handling global exceptions through exceptionhandler (Global exception handling) - SSM in depth analysis and project practice

2020-11-06 01:14:15 Memory

All the source code in the project can be found in the linked repository :https://github.com/chenhaoxiang/uifuture-ssm

8.1.3 adopt ExceptionHandler Handling global exceptions

Use ExceptionHandler Annotations can intercept global exceptions , In fact, in front of 5.5 Section has been demonstrated by examples . Here's a little more simple explanation .

in addition ,ExceptionHandler Annotations can be Controller Defined internally , Then the method intercepts and processes the Controller( Or any subclass ) Zhongyou ExceptionHandler The corresponding exception thrown by the annotation method .

If ExceptionHandler It's defining ControllerAdvice In annotated classes , All the corresponding exceptions thrown by the controller will be handled . Next, for these two ways &

版权声明
本文为[Memory]所创,转载请带上原文链接,感谢