开发者

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
{
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜