【error处理】org.springframework.http.converter.HttpMessageConversionException: Type definition error

【error处理】org.springframework.http.converter.HttpMessageConversionException: Type definition error_第1张图片

控制台的error日志:

org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class com...entity..[某一具体实体类]]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class com...entity..[某一具体实体类] and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)

划重点:

  • org.springframework.http.converter.HttpMessageConversionException
  • Type definition error 定义错误
  • No serializer found 序列化器无法找到
  • no properties discovered 属性没法找到(没有getter、setter)

原因

忘记在实体类上加 @Data 注解

解决

对应的实体类上加上 @Data 注解

你可能感兴趣的:(SpringBoot,spring,spring,boot)