Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
{snippet:id=example5|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/camelContextRouteBuilderRef.xml}

Using <package>

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, specifing specifying the packages to be recursively searched for RouteBuilder implementations. To use this feature in 1.X, requires a <package></package> tag specifying a comma separated list of packages that should be searched e.g.

...

Warning

Use caution when specifying the package name as org.apache.camel or a sub package of this. This causes Camel to search in its own packages for your routes which could cause problems.

Warning
package is @deprecated
package is @deprecated

The <package> tag has been @deprecated and replaced with the more powerful <packageScan> tag. See below.
It will remain in Camel 2.x but will be removed in Camel 3.0

Using <packageScan>

In 2.X this has been extended to allow selective inclusion and exclusion of discovered route classes using Ant like path matching. In spring this is specified by adding a <packageScan/> tag. The tag must contain one or more 'packages' elements (similar to 1.x), and optionally one or more 'includes' or 'excludes' elements specifying patterns to be applied to the fully qualified names of the discovered classes. e.g.

...