Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

We can use a few annotations to achieve the goal.

Sumit Rawal answered on May 15, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers


We can use a few annotations to achieve the goal.

0

@ControllerAdvice — This annotation allows us to handle exceptions across the whole application, not just to an individual controller.

@RestControllerAdvice — This is the combination of both @ControllerAdvice and @ResponseBody. Using @RestControllerAdvice is the more convenient way for handling Exception with RestfulApi. Otherwise, we have to use @ResponseBody along with the

@ExceptionHandler — This annotation is used to handle the exception. This will be used to write the Controller Advice class file. This is for determining the type of exception a method handles.

Popularity 1/10 Helpfulness 1/10 Language go
Source: Grepper
Tags: annotations go
Link to this answer
Share Copy Link
Contributed on May 15 2023
Sumit Rawal
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.