7.4. Using package scanning
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 add a <package></package> tag specifying a comma separated list of packages that should be searched. For example,
<camelContext>
<packageScan>
<package>com.foo</package>
<excludes>**.*Excluded*</excludes>
<includes>**.*</includes>
</packageScan>
</camelContext>
This scans for RouteBuilder classes in the com.foo and the sub-packages.
You can also filter the classes with includes or excludes such as:
<camelContext>
<packageScan>
<package>com.foo</package>
<excludes>**.*Special*</excludes>
</packageScan>
</camelContext>
This skips the classes that has Special in the name. Exclude patterns are applied before the include patterns. If no include or exclude patterns are defined then all the Route classes discovered in the packages are returned.
? matches one character, * matches zero or more characters, ** matches zero or more segments of a fully qualified name.