The WS (Web Service) Beans are used as the main model in the project, in and above the service layer.
They are JAXB beans generated from XSDs. Besides always having a valid XSD to go with the XML generated,
the generated Java classes have a fluent API for setting values (ex: new Person.withId(1).withFirstName("John")
).
They provide a way to decouple business logic and user facing APIs from a persistent store,
multiple persistent stores, or 3rd party services.
The Spring OXM JAXB marshaller is defined, along with the packages it should manage.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPaths"> <array> <value>org.springbyexample.schema.beans.entity</value> <value>org.springbyexample.schema.beans.person</value> <value>org.springbyexample.schema.beans.response</value> </array> </property> </bean> </beans>