0

我正在尝试为 Weblogic 和 Jboss 移植 rest 应用程序。目前我们正在使用球衣作为休息应用程序。带有可移植实现的 jboss 将使用 resteasy。

上下文:在我们的应用程序中,我们是@Provider使用ContextResolver<JAXBContext>return JSONJAXBContextwith的类JSONConfiguration.natural().build()。所以我试图找到Jackson或Jettison的上述配置内部使用的球衣。请帮助我。

4

1 回答 1

2

Consider forgetting anything to do with Jersey, if you're looking for portability. You can simply use the jackson-jaxrs-json-provider. If you are allowing for resource/providers to be auto-discovered, then there should be no extra configuration for this provider needed.

If you are registering resources/providers explicitly, then you should register either JacksonJsonProvider or JacksonJsonJaxbProvider (if you need JAXB annotation support). If you are using auto-registration (scanning), then as stated earlier, these providers will be be implicitly registered for you.

As for the ContentResolver, if you need to configure the marshaller/unmarshaller, the you should use the Jackson's ObjectMapper (e.g. implements ContextResolver<ObjectMapper>). There are many different configurations for the ObjectMapper

于 2014-12-18T16:09:36.867 回答