Skip to main content

JAXB Properties

JAXB allows the application to specify two sets of properties that modify its behavior: context properties and marshaller properties. CXF allows applications to add to these properties. Take care. In some cases, CXF sets these properties for its own use.

You can add items to both of these property sets via the JAXBDataBinding class. The 'contextProperties' and 'marshallerProperties' properties (in the Spring sense) of JAXBDataBinding each store a Map<String, Object>. Whatever you put in the map, CXF will pass along to JAXB. See the JAXB documentation for details.

Example of Configuring a Context Property

<jaxws:server id="bookServer"
   serviceClass="org.apache.cxf.mytype.AnonymousComplexTypeImpl"
   address="http://localhost:8080/act" 
   bus="cxf">
   <jaxws:invoker>
      <bean class="org.apache.cxf.service.invoker.BeanInvoker">
         <constructor-arg>
            <bean class="org.apache.cxf.mytype.AnonymousComplexTypeImpl"/>
         </constructor-arg>
      </bean>
   </jaxws:invoker>
   <jaxws:dataBinding>
      <bean class="org.apache.cxf.jaxb.JAXBDataBinding">
         <property name="contextProperties">
            <map>
               <entry>
                  <key>
                     <value>com.sun.xml.bind.defaultNamespaceRemap</value>
                  </key>
                  <value>uri:ultima:thule</value>
               </entry>
            </map>
         </property>
      </bean>
   </jaxws:dataBinding>
</jaxws:server>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!