封装完毕Result返回类,使用PostMan测试时报错
{"timestamp": "-06-03T10:38:03.144+0000","status": 500,"error": "Internal Server Error","message": "No converter found for return value of type: class com.jia.wxbike.utils.Result","path": "/bike/addBike"}
IDEA控制台报错如下:
-06-03 18:37:00.126 WARN 25904 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class com.jia.wxbike.utils.Result]-06-03 18:38:03.142 WARN 25904 --- [nio-8080-exec-4] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class com.jia.wxbike.utils.Result]
解决方法:查询得知因为Result类缺少Get,Set方法,使用lombok的@Data注解,或者手动添加Get,Set方法即可解决。