Reputation: 370
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?
Upvotes: 0
Views: 929
Reputation: 1857
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)
Upvotes: 0