未找到类 org.hibernate.proxy.pojo.bytebuddy.ByteBuddy.ByteBuddyInterceptor 的序列化程序
2022-08-31 09:39:33
当我尝试导航到端点时,我收到以下错误
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)
我检查了我所有的模型,所有属性都有 getter 和 setter。那么问题出在哪里呢?
我可以通过添加来解决这个问题,但我认为这只是一个隐藏异常的工作。spring.jackson.serialization.fail-on-empty-beans=false
编辑
Product
型:
@Entity
public class Product {
private int id;
private String name;
private String photo;
private double price;
private int quantity;
private Double rating;
private Provider provider;
private String description;
private List<Category> categories = new ArrayList<>();
private List<Photo> photos = new ArrayList<>();
// Getters & Setters
}
PagedResponse
类:
public class PagedResponse<T> {
private List<T> content;
private int page;
private int size;
private long totalElements;
private int totalPages;
private boolean last;
// Getters & Setters
}
RestResponse
类:
public class RestResponse<T> {
private String status;
private int code;
private String message;
private T result;
// Getters & Setters
}
在我的控制器中,我返回ReactEntity<RestResponse<PagedResponse<Product>>>