在JBoss 7.1.1的RESTEasy设置JSON提供程序 [英] Set JSON provider at RESTEasy on JBoss 7.1.1
问题描述
如何在JBoss 7.1.1中为RestEasy设置JSON提供程序?
RestEasy文档说:
RESTEasy允许您将JSON注释的JAXB带注释的POJO封送. 该提供程序包装了Jettison JSON库来完成此操作.
但是我发现似乎在JBoss 7.1.1上,Resteasy使用了Jackson提供程序,因为我的类字段上的@XmlTransient被忽略了,但是@JsonIgnore被处理了.
我如何告诉Resteasy使用Jettison代替Jackson?
在Jboss上,我找到了两个提供程序.
如果只想拉取不同于标准的模块,则可以在jboss特定的部署描述符中提供它.
阅读 https://docs.jboss.org/author /display/AS71/Class + Loading + in + AS7 了解详细信息,并阅读 How could I set JSON provider for RestEasy at JBoss 7.1.1? RestEasy documentation says: RESTEasy allows you to marshall JAXB annotated POJOs to and from JSON.
This provider wraps the Jettison JSON library to accomplish this. But I found that it seems that on JBoss 7.1.1 Resteasy uses Jackson provider because @XmlTransient on my class field was ignored, but @JsonIgnore was processed. How can I tell to Resteasy to use Jettison instead of Jackson? On Jboss I found both providers. if you just want to have a different module pulled than the standard, you can provide this in a jboss specific deployment descriptor. Read https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7 to learn the details, and read https://docs.jboss.org/author/display/AS7/Implicit+module+dependencies+for+deployments to learn what modules JBoss uses by default. To exchange the two providers, provide a This switched the provider for me. Br Alexander.
这篇关于在JBoss 7.1.1的RESTEasy设置JSON提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
META-INF/jboss-deployment-structure.xml
with the following content below. <jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
</exclusions>
<dependencies>
<module name="org.jboss.resteasy.resteasy-jettison-provider" />
</dependencies>
</deployment>
</jboss-deployment-structure>