JPA 懒加载带来的问题
作者:互联网
原理暂不清楚,先记录待解决。
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: 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: top.harmonytqs.entity.Demo$HibernateProxy$wprVXf6u["hibernateLazyInitializer"])
解决方法:在实体类上加上如下注解
//忽略序列化:在 json 序列化时忽略bean中的一些不需要转化的属性
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
标签:reference,No,JPA,top,忽略,带来,hibernateLazyInitializer,序列化,加载 来源: https://www.cnblogs.com/200ok/p/15219898.html