Error Handling
In this lesson, you will learn about handling errors in Spring Boot, using code examples.
We'll cover the following...
We'll cover the following...
What is exception handling?
Exception handling is a mechanism that handles errors. In our case, it is the mechanism to handle any errors that may occur when sending a request or receiving a response from a Spring Boot application.
Ways to handle an exception
Spring Boot provides us with various ways to handle the exception. Let’s look at a few of them.
Using ControllerAdvice
and ExceptionHandler
Spring Boot automatically resolves classes annotated with ControllerAdvice
and applied globally to all the controllers. These classes having methods annotated with ...