异常栈信息:
Type definition error: [simple type, class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor]; nested exception is 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.shuziby.common.core.R[\"data\"]->com.shuziby.common.security.entity.User$HibernateProxy$JHagNc26[\"hibernateLazyInitializer\"])
方法一
spring: jackson: serialization: FAIL_ON_EMPTY_BEANS: false若转化hibernateLazyInitializer失败,不会抛出异常,解析为null.该方法会在解析后的json中存在hibernateLazyInitializer字段
方法二
@JsonIgnoreProperties(value={"hibernateLazyInitializer"})直接忽略hibernateLazyInitializer属性