Niranjan Niranjan - 15 days ago 9
Java Question

Apache Camel Package Scan

Is it possible in Apache Camel config to provide multiple package scans? For an instance, can I provide this?

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<package>com.demo.package1</package>
<package>com.demo.package2</package>
</camelContext>


Thanks,
NN

Answer

Yes, this is possible. The Apache Camel documentation page:

http://camel.apache.org/spring.html

states, under the section entitled, "Using <packageScan>":

"Camel also provides a powerful feature that allows for the automatic discovery and initialization of routes in given packages. This is configured by adding tags to the camel context in your spring context definition, specifying the packages to be recursively searched for RouteBuilder implementations. To use this feature in 1.X, requires a tag specifying a comma separated list of packages that should be searched e.g."

<camelContext xmlns="http://camel.apache.org/schema/spring">
  <package>org.apache.camel.spring.config.scan.route</package>
</camelContext>