我开发了Spring Boot + Spring Data Jpa Rest示例。我开发了下面的代码并给出了下面的错误,即使我无法启动 Swagger 也给我错误。
{
"timestamp": "2019-07-22T15:29:04.487+0000",
"status": 500,
"error": "Internal Server Error",
"message": "Could not write JSON: Infinite recursion (StackOverflowError); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: java.util.ArrayList[0]->com.example.demo.entity.Employee[\"department\"]->com.example.demo.entity.Department$HibernateProxy$muKgohop[\"employees\"])",
"path": "/employees/findEmployees/john"
}
RangeError:在 Mt.map (immutable.js:4401) 在 e (utils.js:64) 在 immutable.js:3016 在 immutable.js:2699 在 ft.__iterate (immutable.js:2206)在 Mt.__iterate (immutable.js:2698) 在 r.Lt.r.__iterateUncached (immutable.js:3015) 在 le (immutable.js:604) 在 rJ__iterate (immutable.js:274) 在 r.forEach (immutable .js:4381)
Employee.java
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
public class Employee implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="EMPLOYEE_ID")
private Long employeeId;
@Column(name="FIRST_NAME")
private String firstName;
@Column(name="LAST_NAME")
private String lastName;
@Column(name="EMAIL_ID")
private String email;
@Column(name="STATUS")
private String status;
@Column(name="BIRTH_DATE")
private LocalDate birthDate;
@Column(name="PROJECT_ASSOCIATION")
private Integer projectAssociation;
@Column(name="GOAL_COUNT")
private Integer goalCnt;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "DEPT_ID", nullable = false)
private Department department;
}
摇曳的蔷薇
守着一只汪
相关分类