问题详情
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed;
nested exception is org.springframework.http.converter.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: cn.ijunfu.utils.JSONData["data"]-
>org.springframework.data.domain.PageImpl["content"]-
>java.util.Collections$UnmodifiableRandomAccessList[0]-
>cn.ijunfu.modules.sys.entry.Menu["parent"]-
>cn.ijunfu.modules.sys.entry.Menu$HibernateProxy$vaSE5Gn9["hibernateLazyInitializer"])] with root cause
解决
在对应的实体类cn.ijunfu.modules.sys.entry.Menu
上添加注解
@JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
原因
实体类cn.ijunfu.modules.sys.entry.Menu
的parent
字段值为null