rapt rapt - 3 months ago 8
Java Question

Camel <packageScan> not working?

Using Camel 2.15.2, Spring 4.1.7.RELEASE.

Project: camel-example-cxf-tomcat

Route is created:

<bean id="myRoutes" class="org.apache.camel.example.cxf.CamelRoute"/>

<camelContext xmlns="http://camel.apache.org/schema/spring">
<routeBuilder ref="myRoutes"/>
</camelContext>


Route is not created:

<bean id="myRoutes" class="org.apache.camel.example.cxf.CamelRoute"/>

<camelContext xmlns="http://camel.apache.org/schema/spring">
<packageScan>
<package>org.apache.camel.example.cxf</package>
<excludes>*Hide*</excludes>
</packageScan>
</camelContext>

Answer

Issue because, camel package scan will ignore already instantiated classes. So remove your below code and try.

<bean id="myRoutes" class="org.apache.camel.example.cxf.CamelRoute"/>

Hope it helps!!