org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON
记一次踩坑经历:
Resolved [org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: (was java.lang.NullPointerException); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: com.renqijie.pojo.vo.IndexBean["images"]->java.util.ArrayList[0]->com.renqijie.pojo.Image["id"])]
原因:
JavaBean类Image
中有一个属性类型刚开始设置成int
类型,生成getter/setter
方法后,又将其改成了Integer
类型,结果就出现了上述情况