Hi

We will introduce a <contextScan> as an alternative. Then it scans
the, eg. Spring App Context for RouteBuilders.
Then you can just @Component or whatever you do with Spring on your
RouteBuilder and use the Spring <component-scan>.

Then you got an alternative to package. One which only looks in the context.
Then its not confused as it may be now.

There is a JIRA ticket about this.



On Tue, Jun 8, 2010 at 4:21 PM, Charles Moulliard <cmoulli...@gmail.com> wrote:
> Is there a compelling reason to use the <package> approach in your use case?
> NO. The idea was through one example to show to the client that we can
> combine different approaches IoC of Spring, Injection, Spring-XML
>
> KR,
>
> Charles Moulliard
>
> Senior Enterprise Architect (J2EE, .NET, SOA)
> Apache Camel/ServiceMix Committer
>
> *******************************************************************
> - Blog : http://cmoulliard.blogspot.com
> - Twitter : http://twitter.com/cmoulliard
> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
>
>
> On Tue, Jun 8, 2010 at 12:28 PM, Adrian Trenaman <trena...@progress.com> 
> wrote:
>> Hmmm: have to say, I never quite liked that <package> scan approach: I 
>> prefer to simply create the route builder explicitly. Am I being luddite or 
>> simply old fashioned? Is there a compelling reason to use the <package> 
>> approach in your use case?
>>
>>
>>
>> ----- Original Message -----
>> From: Charles Moulliard <cmoulli...@gmail.com>
>> To: users@camel.apache.org <users@camel.apache.org>
>> Sent: Tue Jun 08 03:07:15 2010
>> Subject: RouteBuilder & Spring Bean injection
>>
>> Hi,
>>
>> I have the following question.
>>
>> What is the best way to inject a spring bean in a camel Routebuilder
>> class when this class is instantiated by camel through spring
>> <camelContext><package> ?
>>
>> ex :
>>
>>        <camelContext trace="true" 
>> xmlns="http://camel.apache.org/schema/spring";>
>>            <package>com.fusesource.camel.exercises.jms.transaction</package>
>>
>> public class TransactionalJMSMessageProcessor extends RouteBuilder {
>>
>>        private static final Logger logger =
>> LoggerFactory.getLogger(TransactionalJMSMessageProcessor.class);
>>
>>       �...@endpointinject(ref="queueIncoming")
>>        private Endpoint sourceUri;
>>
>>       �...@endpointinject(ref="queueOutgoing")
>>        private Endpoint targetUri;
>>
>>        private JdbcTemplate jdbcTemplate;
>>
>>        // Field to be setted by Spring with DataSource
>>        public void setDataSource(DataSource dataSource) {
>>                this.dataSource = dataSource;
>>                jdbcTemplate = new JdbcTemplate(dataSource);
>>        }
>>
>> Using @Autowired ?
>>
>> KR,
>>
>> Charles Moulliard
>>
>> Senior Enterprise Architect (J2EE, .NET, SOA)
>> Apache Camel/ServiceMix Committer
>>
>> *******************************************************************
>> - Blog : http://cmoulliard.blogspot.com
>> - Twitter : http://twitter.com/cmoulliard
>> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to