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 <[email protected]> To: [email protected] <[email protected]> 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
