骆驼 <packageScan> 不工作?
Camel <packageScan> not working?
使用 Camel 2.15.2,Spring 4.1.7.RELEASE。
路线已创建:
<bean id="myRoutes" class="org.apache.camel.example.cxf.CamelRoute"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<routeBuilder ref="myRoutes"/>
</camelContext>
未创建路线:
<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>
问题是因为,camel 包扫描将忽略已经实例化的 类。因此,请删除您的以下代码并尝试。
<bean id="myRoutes" class="org.apache.camel.example.cxf.CamelRoute"/>
希望对您有所帮助!!
请分享您在创建路线时遇到的错误。
<package> and <packageScan>
将跳过 class 已经由 Spring 等创建的任何 classes。因此,如果您将路由构建器定义为 spring bean 标记,则class 将被跳过。您可以使用 <routeBuilder ref="theBeanId"/> or the <contextScan>
功能包含这些 bean。
尝试使用
<packageScan>
<package>---specify package containing route here---
</package>
</packageScan>
使用 Camel 2.15.2,Spring 4.1.7.RELEASE。
路线已创建:
<bean id="myRoutes" class="org.apache.camel.example.cxf.CamelRoute"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<routeBuilder ref="myRoutes"/>
</camelContext>
未创建路线:
<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>
问题是因为,camel 包扫描将忽略已经实例化的 类。因此,请删除您的以下代码并尝试。
<bean id="myRoutes" class="org.apache.camel.example.cxf.CamelRoute"/>
希望对您有所帮助!!
请分享您在创建路线时遇到的错误。
<package> and <packageScan>
将跳过 class 已经由 Spring 等创建的任何 classes。因此,如果您将路由构建器定义为 spring bean 标记,则class 将被跳过。您可以使用 <routeBuilder ref="theBeanId"/> or the <contextScan>
功能包含这些 bean。
尝试使用
<packageScan>
<package>---specify package containing route here---
</package>
</packageScan>