错误
运行时异常:Type definition error: [simple type, class org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory E n h a n c e d R e s u l t O b j e c t P r o x y I m p l ] ; n e s t e d e x c e p t i o n i s c o m . f a s t e r x m l . j a c k s o n . d a t a b i n d . e x c . I n v a l i d D e f i n i t i o n E x c e p t i o n : N o s e r i a l i z e r f o u n d f o r c l a s s o r g . a p a c h e . i b a t i s . e x e c u t o r . l o a d e r . j a v a s s i s t . J a v a s s i s t P r o x y F a c t o r y EnhancedResultObjectProxyImpl]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory EnhancedResultObjectProxyImpl];nestedexceptioniscom.fasterxml.jackson.databind.exc.InvalidDefinitionException:Noserializerfoundforclassorg.apache.ibatis.executor.loader.javassist.JavassistProxyFactoryEnhancedResultObjectProxyImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.ruoyi.framework.web.page.TableDataInfo[“rows”]->com.github.pagehelper.Page[0]->com.ruoyi.project.system.student.domain.ZStudent_$$_jvst12a_0[“handler”])
解决方法
会报这个错误是因为序列化的问题。
1.改变该查询的懒加载属性 fetchType=“eager”
<collection ... fetchType="eager">
</collection>
2.返回的类加上注解(即实体类)
@JsonIgnoreProperties(value = { "handler" })
3.配置json转换器属性SerializationFeature.FAIL_ON_EMPTY_BEANS为false
该方法请参考请点击此处跳转到解决方案