spring 数据中的 Pagingandsortingrepositrory,响应中不存在实体中的主键

Pagingandsortingrepositrory in spring data , primary key in the entity is not present in the response

我已经为 JPA 实体声明了 pagingandSortingRepository,下面是对 findall() 的响应

"_embedded" : {
    "assetDashboardCustomers" : [ {
      "utilization" : "80",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/utilbycustomer/Customer01"
        },
        "assetDashboardCustomer" : {
          "href" : "http://localhost:8080/utilbycustomer/Customer01"
        }
      }
    },

我不想要 _links 和自我 [HATEOAS] 细节,只想要普通的 JSON。 我应该设置什么 属性 以便在响应

中得到一个普通的 JSON

The first comment answers your first question - you cannot turn off the links. The second comment answers you 2nd question which is how to have the ID in the JSON body.

--- Alan hay 在评论中发表