6.12. XML ルートの追加
デフォルトでは、Camel XML ルートをディレクトリー camel の下のクラスパスに配置できます。このルートは、camel-spring-boot によって自動検出されて組み込まれます。Camel バージョン 2.17 以降では、以下のように設定オプションを使用して、ディレクトリー名を設定したり、この機能を無効にすることができます。
// 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>
<camelContext> と Spring XML ファイルを使用する場合、Camel を Spring XML ファイルおよび application.properties ファイルで設定できます。たとえば、Camel に名前を設定し、ストリームキャッシュを有効にするには、以下を追加します。
camel.springboot.name = MyCamel
camel.springboot.stream-caching-enabled=true