PDA

View Full Version : jaxb1 behaviour



garpinc2
Sep 26th, 2006, 09:09 AM
1) With sping-ws integration what's the recomended way to instantiate beans in app context given you are supposed to use ObjectFactory to instantiate beans

2) is there an abstraction that would avoid tying your code to jaxb through mention of objectFactory in the case you have to instantiate bean in code

3) I was using castor b4 and now I want to use jaxb. I have multiple packages where in the root of both packages, I have classes of the same name. With castor that wasn't a problem I just needed to specify when I receive x in xml then use class y.. i.e:

<mapping>
<description>Description of the mapping</description>
<class name="com.xxx.common.domain.xsd.java.errormessagereply.E rrorMessageReply"
auto-complete="true">
<map-to xml="ErrorMessageReply"/>
</class>

How do I do that with jaxb1

Arjen Poutsma
Sep 27th, 2006, 06:25 AM
1) With sping-ws integration what's the recomended way to instantiate beans in app context given you are supposed to use ObjectFactory to instantiate beans


Interesting. I usually directly use to the implementation classes. You could wire up an ObjectFactory, of course, but since it doesn't implement an interface, it is harder to mock in unit tests.


2) is there an abstraction that would avoid tying your code to jaxb through mention of objectFactory in the case you have to instantiate bean in code


Not yet. All marshalling frameworks are different, so it is hard to accomplish this. It's an interesting thought though, and perhaps I should investigate it further.


3) I was using castor b4 and now I want to use jaxb. I have multiple packages where in the root of both packages, I have classes of the same name. With castor that wasn't a problem I just needed to specify when I receive x in xml then use class y.. i.e:

<mapping>
<description>Description of the mapping</description>
<class name="com.xxx.common.domain.xsd.java.errormessagereply.E rrorMessageReply"
auto-complete="true">
<map-to xml="ErrorMessageReply"/>
</class>

How do I do that with jaxb1

Perhaps you can use multiple marshallers? And tie them to particular endpoints?