更改WebSphere Application Server上的默认JSON提供程序 [英] Change Default JSON Provider on WebSphere Application Server
问题描述
我需要知道如何在WebSphere Application Server环境(版本8.0和8.5)上覆盖默认的JSON提供程序.由于杰克逊图书馆版本1.6( https://github.com/FasterXML/jackson-module-jaxb-annotations/issues/3 ).
I need to know how to override the default JSON Provider on a WebSphere Application Server Environment (versions 8.0 and 8.5). I need to do that due a to an issue found on Jackson library version 1.6 (https://github.com/FasterXML/jackson-module-jaxb-annotations/issues/3).
如果有人能提供帮助,那将是非常受欢迎的.
If anyone could help would be more than welcome.
推荐答案
无论您是想完全避免使用Jackson还是只想使用其他版本,我都不太明白.
I did not quite get whether you want to avoid using Jackson at all or you just want a different version.
在您的应用程序中,您可以注册所需的提供者.例如,要使用Jettison,您需要满足以下条件:
In your application you can register the providers you want. For example, to use Jettison you need the following:
import org.apache.wink.providers.jettison.JettisonJAXBProvider;
import javax.ws.rs.core.Application;
import java.util.HashSet;
import java.util.Set;
public class YourApplication extends Application {
@Override
public Set<Object> getSingletons() {
Set<Object> singletons = new HashSet<Object>();
JettisonJAXBProvider jaxbProvider = new JettisonJAXBProvider();
singletons.add(jaxbProvider);
return singletons;
}
}
如果您需要其他Jackson版本,为什么不将其放入WEB-INF/lib并将Web模块类加载策略设置为PARENT_LAST?
If you need different Jackson version, why not just put it into WEB-INF/lib and set web module classloading policy to PARENT_LAST?
这篇关于更改WebSphere Application Server上的默认JSON提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!