Using BigDecimal in JAXB marshalling

前端 未结 2 840
栀梦
栀梦 2021-02-19 23:28

I have a REST webservice with JAXB fields annotations. For example,

@XmlAccessorType(XmlAccessType.PROPERTY)
public class MyClass{
  private BigDecimal sum;
  /         


        
2条回答
  •  执笔经年
    2021-02-19 23:31

    You write an XmlAdapter and you annotate the getter of sum with it: @XmlJavaTypeAdapter(BigDecimalStringAdapter.class).

提交回复
热议问题