Failed to write HTTP message,Could not write JSON错误

今天遇到使用@ResponseBody注解返回json数据时报错

Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: (was java.lang.NullPointerException);

我一直打了断点 直到数据都拿到了,只是在最后转json的时候报错了,最后才发现是因为继承了父类的属性,最后自己也重写了父类的属性,有自己的get set方法,后面将自己与父类共有的属性去掉,直接使用父类的,就没报错了

猜你喜欢

转载自blog.csdn.net/youxiu326/article/details/82758219