java - JiBXException : Multiple bindings defined for class

标签 java binding mapping jibx

奇怪的事情...

我有一个绑定(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/

相关文章:

java - 在 for 循环中将对象添加到数组中。与设置和获取。

java - 升级到 Spring Boot 2.0.2 后,Spring Security .permitAll() 不再有效

java - JBOSS 中的多个 SLF4J 绑定(bind)导致错误

java - War 在本地独立 tomcat 7(无 eclipse)上运行良好,上传到 ec2 时不起作用

java - 在 Android 中使用另一个 List<String> 追加到全局列表 <String>

c# - 在 WPF 控件中将事件处理程序声明为静态或非静态

c# - 从 xaml 中清除 dependencyProperty 值

android - 安卓 map 编码区

java - 在 Android 中使用 MapStruct 来映射泛型类型?

opencv - 如何正确使用单应矩阵?