2
这就是我想要做的事:抽象类的XmlRootElement注释 - 可能吗?
@XmlRootElement(name = "bar")
@XmlAccessorType(XmlAccessType.NONE)
public abstract class Bar {
}
public final class Foo extends Bar {
@XmlElement
public String getMsg() {
return "hello, world!";
}
}
现在我想马歇尔Foo
类的一个实例:
com.sun.istack.SAXException2: unable to marshal type "Foo" as
an element because it is missing an @XmlRootElement annotation
什么是解决方法吗?