Springboot file upload exceeds the limit exception handling

Copyright: https://blog.csdn.net/Dongguabai/article/details/90517905

General upload file size limit so:

This can indeed limit, but do not be global anomalies Spring MVC exception interceptor intercepted, because exceptions are thrown by Tomcat, before entering the Controller to throw up.

Here are a solution, not controlled by Tomcat, can be directly controlled by the Spring MVC interceptors:

 Then the interceptor registered to Spring MVC interceptors.

Guess you like

Origin blog.csdn.net/Dongguabai/article/details/90517905