Java exception encapsulation in the Service layer

The dao layer does not need to throw exceptions. It should throw exceptions at the service layer, which can be custom exceptions or wrapping exceptions, and then define exception handlers in the controller for unified processing or separate processing.

 

refer to:

https://segmentfault.com/q/1010000006653269

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324972383&siteId=291194637