You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
这报错就一直报 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) (through reference chain: com.example.demo.User["role"]
循环引用问题:@JsonManagedReference and @JsonBackReference
public class User {
public int id;
public String name;
@JsonManagedReference
public List<Item> userItems;
}
public class Item {
public int id;
public String itemName;
@JsonBackReference
public User owner;
}
解决方法入下:
1. spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false
2. 配置ObjectMapper
https://stackoverflow.com/questions/28862483/spring-and-jackson-how-to-disable-fail-on-empty-beans-through-responsebody
The text was updated successfully, but these errors were encountered: