camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: RouteBuilder & Spring Bean injection
Date Tue, 08 Jun 2010 14:21:54 GMT
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 <TRENAMAN@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 <cmoulliard@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
>

Mime
View raw message