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?
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.
Looks like this is available in Jackson 1.7:
http://jira.codehaus.org/browse/JACKSON-163
See last comment.
Yes, like this
@JacksonXmlRootElement(localName = "SOMETHING_ELSE")
public class MyClass
{
}
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论