1
是否有可能使用JSON作为输出模式的共享引用的概念?我读过这篇文章http://blog.bdoughan.com/2010/10/jaxb-and-shared-references-xmlid-and.html),但将JAX-RS上的@Produces更改为JSON会导致无限循环。基本上我想减少的目的是它单曲ID:与json共享refrences
public class Foo {
private long id;
private String someText;
private Bar bar;
}
我想这个绑定的这种情况下,像这样:
{
"id": 1234,
"someText": "lorem",
"bar_id": 9876
}
这正是我想避免:
{
"id": 1234,
"someText": "lorem",
"bar": {
"id": 9876,
"anotherText": "ipsum"
}
}
谢谢先生。我之前在提供的链接上磕磕绊绊,但无法实现自定义应用程序,因为我错过了正确的moxy jar。 – Imperative