fastjson 对象转json报错

com.fasterxml.jackson.databind.exc.InvalidDefinitionException将对象转为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.User H i b e r n a t e P r o x y HibernateProxy HibernateProxyPi8zbvyr[“hibernateLazyInitializer”])

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

你可能感兴趣的:(fastjson 对象转json报错)