2

I am in the process of learning the CXF framework and I know that it uses both Spring and JAXB.

My understanding is that CXF utilizes Spring for IoC and AOP and that it uses JAXB as the default data binding component.

So Spring uses XML to bind POJOs and CXF uses XML (JAXB) too.

But does Spring rely on JAXB at all?

If so, for what purpose?

Clarifying this would help me better understand the relationship between the various components. A block diagram would be even better. Thanks.

Withheld
  • 4,603
  • 10
  • 45
  • 76

2 Answers2

5

Spring is not tied to any particular XML binding technology.

Out of the box Spring supports XML-to-POJO marshalling (and the converse unmarshalling) via several different mapping technologies, of which JAXB is included. You could just as easily use Castor, XMLBeans, JiBX, and XStream or implement your own marshaller/unmarshaller to use Spring's OXM faculties. See the OXM Chapter of the Spring Reference Manual for more details.

Note that you don't need to specify a marshaller/unmarshaller implementation if you're not actually using Spring's OXM functionality.

ach
  • 6,164
  • 1
  • 25
  • 28
0

I am not familiar with the CXF source code but sounds like the relationship between Spring and JAXB, as wired within it, is at arms length so to speak -- each module does its own (much like you described) but each could be replaced with another framework that does the same thing and conforms to a common interface.

See:

Component-based development

Separation of concerns

Programming to interface

Community
  • 1
  • 1
amphibient
  • 29,770
  • 54
  • 146
  • 240