原理暂不清楚,先记录待解决。
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"})
JPA 懒加载带来的问题