300.9.5.3. XML 파일 사용
XML DSL을 사용하여 Camel 경로를 정의할 수도 있지만 Spring 또는 Blueprint를 사용하지 않는 경우 XML 파일에는 Camel 경로만 포함할 수 있습니다.
web.xml에서 다음과 같이 "classpath", "file" 또는 "http" URL에서 될 수 있는 XML 파일을 참조합니다.
<context-param>
<param-name>routeBuilder-MyRoute</param-name>
<param-value>classpath:routes/myRoutes.xml</param-value>
</context-param>XML 파일은 다음과 같습니다.
routes/myRoutes.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- the xmlns="http://camel.apache.org/schema/spring" is needed -->
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="foo">
<from uri="direct:foo"/>
<to uri="mock:foo"/>
</route>
<route id="bar">
<from uri="direct:bar"/>
<to uri="mock:bar"/>
</route>
</routes>XML 파일에서 root 태그는 네임스페이스 "http://camel.apache.org/schema/spring"를 사용해야 하는 <routes>입니다. 이 네임스페이스에는 이름에 Spring이 있지만 Spring이 처음이고 이전에는 XML DSL만 있기 때문에 기록적인 이유가 있기 때문입니다. 런타임 시 Spring JAR이 필요하지 않습니다. Camel 3.0에서는 네임스페이스의 이름을 일반 이름으로 변경할 수 있습니다.