java.lang.StackOverflowError: null
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:708)
这是我在使用Find Method时遇到的异常。 我正在使用Spring Boot JPA Repository。
@Entity
@Table(name =" Store") 公共类StoreEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long store_id;
private String storeDescription;
private String storeName;
private String lattitude;
private String longitude;
private boolean isActive;
private boolean is247;
private Date createdDate;
private Date lastModifiedBy;
@OneToMany(mappedBy = "store", cascade = CascadeType.ALL)
@JsonIgnoreProperties(value ="store", allowSetters=true)
private Set<GroceryItemEntity> groceryItem;
@Table(name =&#34; Grocery&#34;) 公共类GroceryItemEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long grocery_id;
private String name;
private String description;
private double price;
private boolean isActive;
private Date createdDate;
private Date lastModifiedBy;
@ManyToOne(cascade = CascadeType.ALL )
@JoinColumn(name = "store_id")
@JsonIgnoreProperties(value ="groceryItem", allowSetters=true)
private StoreEntity store;
部分例外
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:708)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
答案 0 :(得分:1)
@JsonIgnoreProperties(value ="groceryItem", allowSetters=true)
在All Mapping中用于修复无限递归的问题。
实际上我改变了我的应用程序的结构。在端点使用Vo而不是实体类