本文主要是介绍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
类型,结果就出现了上述情况
这篇关于org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!