问题
How can I use Lombok in conjunction with my @XmlElement
tags so that I can unmarshall the object?
I have about 20 properties, so I'm looking to not write an explicit getter and setter for each with the XmlElement
tags on the setters.
回答1:
This gets the job done:
@Data
@XmlRootElement(name = "root")
@XmlAccessorType(XmlAccessType.FIELD) // UPDATE: Need this or else exception
public class Data {
@XmlElement(name = "test")
public double testData;
}
来源:https://stackoverflow.com/questions/31884406/use-lombok-with-xmlelement