How do I improve performance of application that uses the JAXBContext.newInstance operation?

后端 未结 5 1118
太阳男子
太阳男子 2020-12-30 01:59

I use the JAXBContext.newInstance operation in my JBoss based web application. This operation, as I understand, is very heavyweight. I only require two unique instances of t

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-30 02:06

    One can use javax.xml.bind.JAXB. It has direct Marshal and unmarshal methods. So you don't have to worry about instance creation of JAXB.

    e.g. JAXB.unmarshal(inputStream/inputFile, outputClassExpected) or JAXB.marshal(jaxbObject, xmlOutputFile/xmlOutputStream)

提交回复
热议问题