原因:因为boot2.3.x版本可能考虑信息安全问题,把以下两个值默认为
server: error: include-message: never include-exception: false
发生异常是返回
{ "timestamp": 1632713940269, "status": 500, "error": "Internal Server Error", "message": "", "path": "/xxxx" }
修改后
server: error: include-message: always include-exception: true
发生异常是返回
{ "timestamp": 1632713940269, "status": 500, "error": "Internal Server Error", "exception": "com.xxxx.xxxxException", "message": "非法访问", "path": "/xxxxx" }
具体查看源代码:BasicErrorController.getErrorAttributeOptions