I can't understand why this JAXB IllegalAnnotationException is thrown

后端 未结 12 1772
渐次进展
渐次进展 2020-12-13 02:03

This is my XML file:


    
    
    
                   


        
12条回答
  •  被撕碎了的回忆
    2020-12-13 02:47

    I once received this message after thinking that putting @XmlTransient on a field I didn't need to serialize, in a class that was annotated with @XmlAccessorType(XmlAccessType.NONE).

    In that case, removing XmlTransient resolved the issue. I am not a JAXB expert, but I suspect that because AccessType.NONE indicates that no auto-serialization should be done (i.e. fields must be specifically annotated to serialize them) that makes XmlTransient illegal since its sole purpose is to exclude a field from auto-serialization.

提交回复
热议问题