我有一个POJO:
public class Step implements IStep {
String identifier;
ApprovalAction action;
Approver approver;
Asset asset;
Outcome decision;
Actor requestedFor;
//...
}
我有一个网络服务方法:
Step step = new BasicApprovalStep(
new ApprovalAction("Name Test", "Description Test", "Instructions Test"),
mockAssetService.getRandomItem(),
mockActorService.getRandomItem());
GenericEntity< Collection<Step> > entity = new GenericEntity<Collection<Step>>(Arrays.asList(new Step[]{step})) {};
System.err.println("Returning " + step + " " + step.getIdentifier() + " " + step.getRequestedFor() + " " + step.getAsset());
return Response.ok(entity).build();
它有这些注释:
@GET
@Produces(MediaType.APPLICATION_JSON)
我总是得到[{}]
作为对我的REST调用的响应。我看到了print语句所以我知道事情是返回数据:
返回BasicApprovalStep @ 20d36037 7bde8abd-3632-47ce-98a3-d1ddafe875a1 entities.Actor@19011a5d entitiess.Asset@442102c
为什么这不起作用,我使用其他服务(审批者,演员等)使用相同的模式(返回这样的结果)并且效果很好?
有什么建议吗?