fastjson 对象转json报错

ionException将对象转为json时报错
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: com.mdh.springboot.entity.UserH i b e r n a t e P r o x y HibernateProxyHibernateProxyPi8zbvyr[“hibernateLazyInitializer”])

解决的方法,在对应的实体类上面加上注解 @JsonIgnoreProperties(value = { “hibernateLazyInitializer”, “handler” })
@JsonIgnoreProperties就是标注 哪个属性 不用转化为json的

猜你喜欢

转载自blog.csdn.net/qq_40093255/article/details/113599162