xfire+spring 生成的客户端代码的实体bean
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EIDUser", propOrder = {
    "password",
    "regTime",
    "username",
    "visible"
})
public class EIDUser {    @XmlElementRef(name = "password", namespace = "http://user.bean.itdos.net", type = JAXBElement.class)
    protected JAXBElement<String> password;
    protected XMLGregorianCalendar regTime;
    @XmlElementRef(name = "username", namespace = "http://user.bean.itdos.net", type = JAXBElement.class)
    protected JAXBElement<String> username;
    @XmlElementRef(name = "visible", namespace = "http://user.bean.itdos.net", type = JAXBElement.class)
    protected JAXBElement<Boolean> visible;
xfire 生成的客户端代码的实体bean@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Customer", propOrder = {
    "email",
    "name",
    "phone"
})
public class Customer {    @XmlElement(required = true)
    protected String email;
    @XmlElement(required = true)
    protected String name;
    @XmlElement(required = true)
    protected String phone;
各位大牛 谁知道怎么回事   什么才能让spring+sfire 生成的代码和 xfire一样

解决方案 »

  1.   


     @XmlElementRef(name = "visible", namespace = "http://user.bean.itdos.net", type = JAXBElement.class)
    protected JAXBElement<Boolean> visible;
        @XmlElement(required = true)
        protected String phone;两者区别
      

  2.   

    一个是动态映射,一个是静态映射(xml element和java bean property之间),可能哪有个开关控制,用都可以用的吧
    @Retention(value=RUNTIME)
    @Target(value={FIELD,METHOD})
    public @interface XmlElementRefMaps a JavaBean property to a XML element derived from property's type.Usage@XmlElementRef annotation can be used with a JavaBean property or from within XmlElementRefsThis annotation dynamically associates an XML element name with the JavaBean property. When a JavaBean property is annotated with XmlElement, the XML element name is statically derived from the JavaBean property name. However, when this annotation is used, the XML element name is derived from the instance of the type of the JavaBean property at runtime.