奇怪的事情...
我有一个绑定(bind)定义 user-wrapper.xml:
<binding>
<include path="core-wrapper.xml" />
<include path="user-composite-entity.xml" />
<mapping name="users" class="UserWrapper" extends="CoreWrapper">
<structure map-as="CoreWrapper" usage="optional" />
<collection field="users" usage="optional" item-type="UserCompositeEntity">
</collection>
</mapping>
</binding>
接下来我有这个绑定(bind)定义 user-composite-entity.xml (包含在上面的文件中):
<binding>
<include path="core-composite-entity.xml" />
<include path="user-entity.xml" />
<mapping name="user" class="UserCompositeEntity" extends="CoreCompositeEntity">
<structure map-as="CoreCompositeEntity" />
<structure field="userEntity" usage="optional" />
<structure field="meta" marshaller="UserMetaHashMapper" unmarshaller="UserMetaHashMapper" usage="optional" />
</mapping>
</binding>
现在,如果我调用使用绑定(bind) user-wrapper.xml 的 REST,映射就会成功完成。如果我调用使用绑定(bind) user-composite-entity.xml 的 REST,我会收到下一个错误:
org.jibx.runtime.JiBXException: Multiple bindings defined for class UserCompositeEntity
现在奇怪的事情(对我来说)。如果我从 user-wrapper.xml <include path="user-composite-entity.xml" />
中删除像这样:
- 使用 user-composite-entity.xml 调用成功,
- 使用 user-wrapper.xml 调用我收到错误:
org.jibx.runtime.JiBXException: No marshaller defined for class UserCompositeEntity
最佳答案
This email thread好像有一些信息。
关于java - JiBXException : Multiple bindings defined for class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1594598/