7.14. 자동 구성을 위해 classpath에 XML 경로 추가

기본적으로 Camel Spring Boot 구성 요소는 자동으로 감지되며 camel 디렉터리의 classpath에 있는 Camel XML 경로를 포함합니다. 구성 옵션을 사용하여 디렉터리 이름을 구성하거나 이 기능을 비활성화할 수 있습니다.

절차

  • 다음과 같이 classpath에서 Camel Spring Boot XML 경로를 구성합니다.

    // turn off
    camel.springboot.xmlRoutes = false
    // scan in the com/foo/routes classpath
    camel.springboot.xmlRoutes = classpath:com/foo/routes/*.xml
    참고

    XML 파일은 CamelContext 요소가 아닌 Camel XML 경로 요소를 정의해야 합니다. 예를 들면 다음과 같습니다.

       <routes xmlns="http://camel.apache.org/schema/spring">
            <route id="test">
                <from uri="timer://trigger"/>
                <transform>
                    <simple>ref:myBean</simple>
                </transform>
                <to uri="log:out"/>
            </route>
        </routes>

Spring XML 파일 사용

<camelContext>와 함께 Spring XML 파일을 사용하려면 Spring XML 파일 또는 application.properties 파일에서 Camel 컨텍스트를 구성할 수 있습니다. Camel 컨텍스트의 이름을 설정하고 스트림 캐싱을 설정하려면 application.properties 파일에 다음을 추가합니다.

camel.springboot.name = MyCamel
camel.springboot.stream-caching-enabled=true