58.3. Spring XML 사용
다음 예제에서는 JaxbDataFormat 을 구성하고 여러 경로에서 사용하는 방법을 보여줍니다.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="myJaxb" class="org.apache.camel.converter.jaxb.JaxbDataFormat">
<property name="contextPath" value="org.apache.camel.example"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
<marshal><custom ref="myJaxb"/></marshal>
<to uri="direct:marshalled"/>
</route>
<route>
<from uri="direct:marshalled"/>
<unmarshal><custom ref="myJaxb"/></unmarshal>
<to uri="mock:result"/>
</route>
</camelContext>
</beans>
다중 컨텍스트 경로
둘 이상의 컨텍스트 경로로 이 데이터 형식을 사용할 수 있습니다. 다음과 같이 : 구분자로 : 을 사용하여 컨텍스트 경로를 지정할 수 있습니다(예: com.mycompany:com.mycompany2 ). 이는 JAXB 구현에서 처리하며 RI와 다른 벤더를 사용하는 경우 변경될 수 있습니다.