in Service Discovery by
Q:
How will you deploy Exception Handling in Microservices?

1 Answer

0 votes
by

If an exception occurs while processing an HTTP request, you need to catch the exception in your controller or service and return an appropriate ResponseEntity manually.  Here are some thumb rules for exception handling.

Add @ResponseStatus for exceptions that you write.

For all other exceptions, implement an @ExceptionHandler method on a @ControllerAdvice class or use an instance of SimpleMappingExceptionResolver. 

For Controller specific exceptions, add @ExceptionHandler methods to your controller. 

Point to be noted is that @ExceptionHandler methods on the controller are always selected before those on any @ControllerAdvice instance. It is undefined in what order ControllerAdvices are processed.

Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

0 votes
asked Dec 20, 2019 in Service Discovery by sharadyadav1986
0 votes
asked Dec 20, 2019 in Service Discovery by sharadyadav1986
...