JAXB - Java-Springs

The JAXB binding compiler translates a W3C XML Schema into one or more Java classes, a jaxb.properties file, and possibly some resource files.JAXB also offers a way to generate a schema from annotated Java classes.

Spring supports the JAXB 2.0 API as XML marshalling strategies, following the Marshaller and Un marshaller interfaces.The corresponding integration classes reside in the org. spring frame work. oxm. jaxb package.


The Jaxb2 Marshaller class implements both the Spring Marshaller and Un marshaller interface. It requires a context path to operate, which you can set using the context Path property. The context path is a list of colon (:) separated Java package names that contain schema derived classes. It also offers a classes To Be Bound property, which allows you to set an array of classes to be supported by the marshaller.Schema validation is performed by specifying one or more schema resource to the bean, like so:

<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<property name="schema" value="classpath:org/springframework/oxm/schema.xsd"/>

XML Schema-based Configuration

The jaxb2-marshaller tag configures a org.springframework.oxm.jaxb.Jaxb2Marshaller. Here is an example:

<oxm:jaxb2-marshallerid="marshaller" contextPath="org.springframework.ws.samples.airline.schema"/>

Alternatively, the list of classes to bind can be provided to the marshaller via the class-to-be-bound child tag:

Available attributes are:-

Available attributes

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Java-Springs Topics