这是我班级的实现,我试图用它来生成XML
import lombok.Getter;
import lombok.Setter;
import org.springframework.hateoas.ResourceSupport;
import javax.xml.bind.annotation.*;
@Getter
@Setter
@XmlRootElement(name="invoice")
public class InvoiceResource extends ResourceSupport {
Long invID;
Float Price;
PurchaseOrderResource purchaseOrder;
}
输出I'得到的是
<invoice xmlns:atom="http://www.w3.org/2005/Atom">
<atom:link rel="self" href="http://localhost:8080/rest/invoices/13"/>
<atom:_link rel="processInvoice" href="http://localhost:8080/rest/invoices/13">
<method>POST</method>
</atom:_link>
<id>13</id>
<dueDate>2014-09-24T03:00:00+03:00</dueDate>
<total>750.0</total>
</invoice>
所需的输出
<invoice>
<link rel="self" href="http://localhost:8080/rest/invoices/13"/>
<id>13</id>
<dueDate>2014-09-24T03:00:00+03:00</dueDate>
<total>750.0</total>
</invoice>
我无法使用@XmlTransient
注释ResourceSupport