No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no pro

数据已经从数据库查询出来了,但是返回的时候还是会报错No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer,但是查看实体明明已经序列化了但是为什么不生效呢

答案是因为Hibernate的延迟加载所以这里是个Hibernate的代理对象。该代理对象有些属性不能被序列化所以会报错

在类型上加注解把不需要序列化的属性屏蔽掉 添加注解@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })

No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no pro

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-06-22
  • 2022-12-23
猜你喜欢
  • 2021-05-30
  • 2021-12-15
  • 2022-12-23
  • 2021-05-26
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案