JAXB with Spring ORM for marshaling tutorial

This extends Basic JAXB tutorial with Maven & XSD – 1 to marshall with Spring OXM and Spring XML.

Right mouse click on target/generated-sources and select “Build Path –> Use as Source Folder

JAXB Spring Marshalling Example

JAXB Spring Marshalling Example

Step 1: add spring-orm to use JAXB and spring-xml to use StringResult.

Step 2: The App class with marshaling logic. It is marshaling the “PersonRequest” that was generated in the previous tutorial from an XSD file using the “maven-jaxb2-plugin”.

Step 3: The Spring context class “applicationContext.xml


Q. How does it know how to map?
A. From the XSD generated Java classes with the JAXB annotations demonstrated in https://www.java-success.com/basic-jaxb-tutorial-with-maven-xsd-1/.


Java Interview FAQs

800+ Java Interview Q&As