java springboot jpa 查询数据报错
No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.demo.jpa.demojpa.entity. H i b e r n a t e P r o x y HibernateProxy HibernateProxyw0yxr9dK[“hibernateLazyInitializer”])
原因:
在转化成json的时候,fasterxml.jackson将对象转换为json报错,发现有字段为null
解决办法:
在实体类上面加
@JsonIgnoreProperties(value = { “hibernateLazyInitializer”,“handler”})
公众号: