我正在尝试执行此方法:
@GetMapping("/all")
public Iterable<AspsortObject> getallasp()
{
return ar.findAll();
}
但我收到此错误:
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:722) ~[jackson-databind-2.10.3.jar:2.10.3]
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:166) ~[jackson-databind-2.10.3.jar:2.10.3]
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) ~[jackson-databind-2.10.3.jar:2.10.3]
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:722) ~[jackson-databind-2.10.3.jar:2.10.3]
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:166) ~[jackson-databind-2.10.3.jar:2.10.3]
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:145) ~[jackson-databind-2.10.3.jar:2.10.3]
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:107) ~[jackson-databind-2.10.3.jar:2.10.3]
我的仓库 :
@Repository
public interface AspsortRepositori extends CrudRepository<AspsortObject,Long>{
@Override
List<AspsortObject> findAll();
}
我应该怎么做才能解决此错误并在前端部分中显示所有数据?
当我在我的实体中添加@JsonIgnore时,您好
@Entity
@Table(name="aspsortobject")
public class AspsortObject {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@JsonIgnore
@ManyToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name = "rfpid")
private Rfpobject rfpid;
private String requestid;
private String aspart;
private String aspname;
private String asporganisation;
private String aspsort;
public AspsortObject() {
super();
}