[ 
https://issues.apache.org/activemq/browse/CAMEL-2787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59926#action_59926
 ] 

Jeremy Norris commented on CAMEL-2787:
--------------------------------------

As per the attached unit test, the spring xml file is configured correctly for 
annotations (ie: <context:component-scan base-package="...").  @Component 
defined route builders can be referenced in the XML via <routeBuilder 
ref="...", even <camelContext depends-on="...".  That all works great.

However, packageScan does not work when the route builders are defined with 
@Component.  Can the package scanner be changed to check the spring context?  
Perhaps another annotation is needed like <scanSpringContext> (this would 
potentially be handy for when route builders are defined in XML too as they 
would need to be referenced again in the <camelContext>).

This isn't a major issue, but I have many routes defined and keeping the two 
lists in sync (ie: @Component and  <routeBuilder ref="..." is tedious and 
error-prone.

Note: dropping the @Component and letting camel manage creating the route 
builder beans is not really an option since I want to do injection on the route 
builders.

> camel:packageScan doesn't work for spring @Components
> -----------------------------------------------------
>
>                 Key: CAMEL-2787
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2787
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-spring
>    Affects Versions: 2.3.0
>         Environment: MacOSX 10.6.3, Java 1.6.0_20
>            Reporter: Jeremy Norris
>            Assignee: Claus Ibsen
>         Attachments: spring-integration-testcase.tar.gz
>
>
> When a route builder is defined using @Component, I have to reference is as 
> follows:
>   <camelContext xmlns="http://camel.apache.org/schema/spring";>
>     <routeBuilder ref="routeBuilderFoo"/>
>   </camelContext>
> Should I not be able to use the following instead?
>   <packageScan>
>     <package>org.jnorris.camel</package>
>   </packageScan>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to