我有两个实体,分别为Course和Topic。这是一对多的关系。当我得到所有课程的清单时,我得到了奇怪的结果。看来它正在获得较长的无限循环结果(我得到的JSON响应只是其中的一部分,但它一直在不断发展)
[
{
"id": "Java",
"name": "Java",
"descr": "This course goes over Java",
"topic": [
{
"id": "java-core",
"name": "Java core",
"descr": "This topic goes over java core",
"course": {
"id": "Java",
"name": "Java",
"descr": "This course goes over Java",
"topic": [
{
"id": "java-core",
"name": "Java core",
"descr": "This topic goes over java core",
"course": {
"id": "Java",
"name": "Java",
"descr": "This course goes over Java",
"topic": [
{
"id": "java-core",
"name": "Java core",
"descr": "This topic goes over java core",
"course": {
"id": "Java",
"name": "Java",
"descr": "This course goes over Java",
"topic": [
{
"id": "java-core",
"name": "Java core",
"descr": "This topic goes over java core",
"course": {
"id": "Java",
"name": "Java",
"descr": "This course goes over Java",
"topic": [
{
"id": "java-core",
"name": "Java core",
"descr": "This topic goes over java core",
答案 0 :(得分:1)
使用
@JsonManagedReference
实例化的第一个对象的注释
@JsonBackReference
实例化的第二个对象的注释