No serializer found for class org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory$Enha

项目中使用了 mybatis 级联查询,返回 json 格式时报错:
 

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory$EnhancedResultObjectProxyImpl and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.ahav.system.entity.SystemResult["data"]->com.ahav.system.entity.User_$$_jvste64_0["handler"])

解决办法是在所有关联类上加 @JsonIgnoreProperties(value = { "handler" })

作用是在 json 序列化时忽略 bean 中的一些不需要转化的属性

猜你喜欢

转载自blog.csdn.net/Victoria__W/article/details/83146557
今日推荐