How to use JAXB annotations in the client side for GWT?

后端 未结 5 1692
孤独总比滥情好
孤独总比滥情好 2020-12-28 18:09

I wanted to use the JaxB annotation in my class like this:

@XmlRootElement
public class ItemExtension implements Serializable {

But GWT com

5条回答
  •  执念已碎
    2020-12-28 18:46

    I have a project that uses entity classes with both JPA and JAXB annotations in the client-side GWT code. See the section "Overriding one package implementation with another" in the GWT Documentation.

    Let's say your module is in package com.example.app. You will need to recreate[1] all JAXB annotation classes in a new package, specifically com.example.app.jre.java.xml.bind.annotation; in your module XML file, you then add and you're set.

    Note that you don't need to distribute the class files in that package, they are needed solely for the sake of the GWT compiler.

    [1]: You can copy them over and adjust all package references.

提交回复
热议问题