A request before you mark it as duplicate. I have gone through the forum and couldn\'t find the solution for the problem anywhere.
I am writing a code using Spring 3
The Jaxb2Marshaller is perfectly capable to work with multiple different contexts/xsd. Simply specify multiple context paths by using the setContextPaths methods.
@Bean(name="A1Unmarshaller")
public Jaxb2Marshaller A1Unmarshaller(){
Jaxb2Marshaller unMarshaller = new Jaxb2Marshaller();
unMarshaller.setContextPaths(
"package name for the classes generate by XSD A1",
"package name for the classes generate by XSD A2",
"package name for the classes generate by XSD A3",
"package name for the classes generate by XSD A4",
"package name for the classes generate by XSD A5" );
return unMarshaller;
}
That way you only need a single marshaller/unmarshaller.
Links