Fastjson object to json report error

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”])

The solution is to add the annotation @JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler" }) to the corresponding entity class.
@JsonIgnoreProperties is to mark which property does not need to be converted to json

Guess you like

Origin blog.csdn.net/qq_40093255/article/details/113599162