我有一个带有 JPA 和 JSON 序列化的 Spring-Boot-Project。我尝试使用 @JsonView 仅序列化指定的属性。它工作正常,但对于我在Order(例如order.user)中的关联,它序列化了空的 Json-Object。
我使用以下依赖项
请参阅以下 Json 结果:
{
"content" : {
"orderResources" : [ {
"receiptDate" : "2019-08-14",
"state" : "BILL_CREATED",
"user" : { },
"employer" : { },
"orderplace" : { },
"propertyManagement" : null,
"plannings" : [ { } ]
}, {
"receiptDate" : "2019-08-17",
"state" : "BILL_CREATED",
"user" : { },
"employer" : { },
"orderplace" : { },
"propertyManagement" : …Run Code Online (Sandbox Code Playgroud)