Many thanks for your idea. That was the good.
By adding : <context:annotation-config/> in my spring application-context
(WHICH IS NOT THE CAMEL CONTEXT)
and
@Autowired in my RouteBuilder class
-->
@Autowired
public void setEndpointName(EndPointName endpointName) {
this.endpointName = endpointName;
}
I'm able to inject endpoint dynamically into the Routes
Regards,
Charles Moulliard
cmoulliard wrote:
>
> No. I will tried annotation and coming back soon.
>
> Regards,
>
> Charles
>
>
> Claus Ibsen wrote:
>>
>> Hi
>>
>> Have you tried using the spring annotations for this? Check the spring
>> reference documentation how to set it up, remember to add the spring
>> context annotation or what the xml tag is named, that enables annotation
>> driven injection.
>>
>> Med venlig hilsen
>>
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>>
>> -----Original Message-----
>> From: cmoulliard [mailto:[EMAIL PROTECTED]
>> Sent: 16. juli 2008 17:11
>> To: [email protected]
>> Subject: Is it possible to inject a bean in a class which extends a
>> org.apache.camel.builder.RouteBuilder ?
>>
>>
>> Hi,
>>
>> I try to inject a bean in a class which extends a
>> org.apache.camel.builder.RouteBuilder without success. So my question is
>> simple, is it possible ?
>>
>> e.g.
>>
>> 1) MyRouterBuilder class wher I want to inject a bean (= EndPoint bean)
>>
>> MyRouterBuilder class {
>>
>> private EndPointName endpointName = null;
>>
>> @Override
>> public void configure() {
>>
>> // endpoint that I would like to inject
>> from(EndPoints.FileClientIn)
>> .to("");
>> }
>>
>> // Inject endpoints dependency through Spring into my RouteBuilder
>> class
>> public void setEndpointName(EndPointName endpointName) {
>> this.endpointName = endpointName;
>> }
>> }
>> 2) Camel context file where the endPoint bean is declared
>>
>> <bean id="endpointName" class="com.myApplication.util.EndPointName">
>> <property name="FileClientIn"
>> value="file:///c:/temp/xxx/clientA/input/?delete=false&lock=true&consumer.delay=500&consumer.initialDelay=10"
>> />
>> <property name="FileClientOutput"
>> value="file:///c:/temp/xxx/clientA/output"
>> />
>> <property name="RejectedQueueClientIn"
>> value="activemq:queue:rejectedmessages.clientA.queue" />
>> <property name="AcceptedQueueClientIn"
>> value="activemq:queue:xxx.clientA.queue" />
>> </bean>
>>
>> Regards,
>>
>>
>>
>> Charles Moulliard
>>
>>
>>
>> -----
>> Enterprise Architect
>>
>> Xpectis
>> 12, route d'Esch
>> L-1470 Luxembourg
>>
>> Phone +352 25 10 70 470
>> Mobile +352 621 45 36 22
>>
>> e-mail : [EMAIL PROTECTED]
>> web site : www.xpectis.com
>> --
>> View this message in context:
>> http://www.nabble.com/Is-it-possible-to-inject-a-bean-in-a-class-which-extends-a-org.apache.camel.builder.RouteBuilder---tp18489666s22882p18489666.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>
>
-----
Enterprise Architect
Xpectis
12, route d'Esch
L-1470 Luxembourg
Phone +352 25 10 70 470
Mobile +352 621 45 36 22
e-mail : [EMAIL PROTECTED]
web site : www.xpectis.com
--
View this message in context:
http://www.nabble.com/Is-it-possible-to-inject-a-bean-in-a-class-which-extends-a-org.apache.camel.builder.RouteBuilder---tp18489666s22882p18504465.html
Sent from the Camel - Users mailing list archive at Nabble.com.