Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure Jackson to use name property of @XmlRootElement

I have a java bean that uses the JAXB annotation: @XmlRootElement(name="beanName"). Is there a way to configure jackson to use the name property of the @XmlRootElement annotation when deserializing?

like image 490
Nash10 Avatar asked Nov 14 '22 03:11

Nash10


1 Answers

One thing I've done to make sure that Jackson uses the @XMLRootElement of a class is to set the provider class to be JacksonJaxbJsonProvider (rather than, e.g. JacksonJsonProvider). This can be done in a number of ways, depending on what JAX-RS implementation you are using, and whether the code is client side or server side.

like image 195
Brendan Avatar answered Nov 16 '22 17:11

Brendan