com.fasterxml.jackson.databind.exc.InvalidDefinitionException

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.hnit.learning_shop.common.Result["data"]->java.util.ArrayList[0]->com.hnit.learning_shop.entity.XcUser_$$_jvst31f_0["handler"])

一般报这个异常大部分是由于没有序列化。

在实体类上加上@JsonIgnoreProperties注解。

@JsonIgnoreProperties(value= {"handler"})

此注解是类注解,作用是json序列化时将Java bean中的一些属性忽略掉,序列化和反序列化都受影响。

原文地址:https://www.cnblogs.com/lhd1998/p/11436574.html