我在尝试对/ users端点执行get请求时遇到问题,而不是返回我想要的东西,而是在下面返回此错误:
java.lang.StackOverflowError: null
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_171]
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~
我的端点方法:
@Override
public ResponseEntity<List<M>> findAll() {
List<M> models = repository.findAll();
if(models == null || models.isEmpty()){
return ResponseEntity.noContent().build();
}
return ResponseEntity.ok(models);
}
用户模型:
@Entity
@Table(name = "UN_USERS")
public class User extends AbstractModel {
@Column(name = "USERNAME", unique = true)
private String username;
@Column(name = "UUID")
private String uuid;
@Column(name = "COINS")
private long coins;
@Column(name = "TOKENS")
private long tokens;
@ManyToOne
@JoinColumn(name = "GROUP_ID", nullable = true)
private Group group;
//getters & setters...
}
组模型:
@Entity
@Table(name="UN_GROUPS")
public class Group extends AbstractModel{
private String prefix;
@OneToMany(mappedBy = "group")
private Set<User> users;
@ManyToMany(mappedBy = "groups")
private Set<Permission> permissions;
}
有什么可能会导致此错误,我该如何解决?
慕森王
富国沪深
相关分类