JPA 报错:org.springframework.http.converter.HttpMessageNotWritableException

org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Infinite recursion (StackOverflowError); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through re......






原因:实体类有的属性是null,导致json化的时候,fasterxml -jackson 将对象转换为json时报错了。




解决方法:找到无法json化的对象,在可能为空的字段上设置@JsonSerialize(include=Inclusion.NON_EMPTY) 




猜你喜欢

转载自blog.csdn.net/daqiang012/article/details/80176609
JPA