定义通用的返回对象和统一异常处理

返回正确的信息

 

返回错误的信息 

 

 

 

Controller中抛出异常.

 

异常处理

新增异常处理类

GlobalExceptionHandler 

再加上Controlleradvice注解

猜你喜欢

转载自blog.csdn.net/weixin_40196043/article/details/84858288