How to generate java class with @XmlRootElement fr

2019-07-30 20:30发布

The xjc way of creating java package is

xjc -wsdl myWsdl.wsdl

This creates package like com

Then for generation of jar

jar cvf myJar.jar com/*

Any way to generate the java classes with @XmlRootElement because my java class does not have it.

PS: using command prompt only

标签: java jaxb2 xjc
2条回答
爷、活的狠高调
2楼-- · 2019-07-30 21:01

xjc tool does not have those options @XmlRootElement is not required.

Use the JAXBElement of the corresponding class in obj factory

查看更多
Animai°情兽
3楼-- · 2019-07-30 21:02

To force generating @XmlRootElement, refer How to generate @XmlRootElement Classes for Base Types in XSD? please.

However, I think you don't need to use @XmlRootElement. The post, No @XmlRootElement generated by JAXB indicates why xjc doesn't always generate @XmlRootElement.

查看更多
登录 后发表回答