1.问题描述:
点击编辑:
然后到后台查询并返回当前实体:
结果 执行完 return resultMap后就报错了:
HttpMessageConversionException: 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: java.util.HashMap[“articleType”]->com.java1234.entity.ArticleTypeHibernateProxyHibernateProxyHibernateProxyarHZcuIZ[“hibernateLazyInitializer”])] with root cause
下面在实体类加上@JsonIgnoreProperties(value = { “hibernateLazyInitializer”})注解 就没有报错了
此注解是类注解,作用是json序列化时将Java bean中的一些属性忽略掉,序列化和反序列化都受影响。 为啥加上此注解 返回map 类型数据就不报错了???