Does Spring have any way of catching/handling ServletException?

780 views Asked by At

I there any predefined way in Spring to catch or handle ServletException? I mean any annotation or class that catches them and provide utility methods for them?

1

There are 1 answers

0
Hichem BOUSSETTA On

There are several techniques and approaches to handle Servlet Exceptions with Spring. I can redirect you to this interesting link:

Exception Handling for REST with Spring

Exceptions can be managed at the DispatchServlet level, Controller level or application level. You can chose the method that better fit your needs.

Exception handling can be implemented per controller (using the old @ExceptionHandler or more recent and easy to use ResponseStatusException), or within global exception handler that centralize all exception management (using @ControllerAdvice)