How to configure cxf:rsServer to use JacksonJsonProvider

Solution Verified - Updated -

Issue

  • We tried to configure the JacksonJsonProvider for cxf:rsServer. However, when we deploy it to Fuse, the system are still using the default JSONProvider (based on Jettison).
<cxf:rsServer id="..." address="/..." serviceClass="..." ...>
        <cxf:providers>
            <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" ></bean>
        </cxf:providers>
        ...
</cxf:rsServer>

  • Understand your quickstart project (quickstarts\cxf\rest) gave an example to use JacksonJsonProvider with jaxrs:server. May we know how to apply the same tocxf:rsServer?
<jaxrs:server id="customerService" address="/crm">
        ...
        <jaxrs:providers>
           <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"></bean>
        </jaxrs:providers>
        ...
    </jaxrs:server>

    <cxf:bus>
        ...
        <cxf:properties>
          <!--
            This property needs to be set 'true' in order to give preference to JacksonJsonProvider
            over the default Jettison provider.
          -->
          <entry key="skip.default.json.provider.registration" value="true" ></entry>
        </cxf:properties>
    </cxf:bus>

Environment

  • Red Hat JBoss Fuse
    • 6.x
  • Apache Camel

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.