You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kikou1984 <hi...@atos.net> on 2015/05/21 11:36:55 UTC
How can i use CDI with the Camel Context
Hi,
I m using camel version 2.10.0.
In my route spring XML , i want to use the CamelContextCDI instead of the
DefaultCamelContext.
How can i do it ?
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<import resource="classpath:/suivi-import-jms.xml" />
<bean id="InitLcl" class="net.InitLCLBean" />
<bean id="CtrlCB2A" class="net.CtrlCb2aLclBean" />
<camelContext id="TM-UNL-TEST"
xmlns="http://camel.apache.org/schema/spring" >
is there a way to change the DefaultCamelContext, or to specify to the a
bean that it must run with CDI container.
In this bean id = "CtrlCB2A", i have the CDI.
public class CtrlContratBean {
@Inject
DateBusinessManager dateBusinessManager;
/**
* Bean Ctrl Contrat
*
* @param exchange
* @return
*/
public List<ContratControllable> ctrlContrat(final Exchange exchange) {
}
And the value of dateBusinessManager still null , may be is there a way to
make like :
<cdi-bean id="CtrlCB2A" class="net.CtrlCb2aLclBean" />
thxs for help, i really don t know to run CDI with camel.
--
View this message in context: http://camel.465427.n5.nabble.com/How-can-i-use-CDI-with-the-Camel-Context-tp5767375.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How can i use CDI with the Camel Context
Posted by Jason Holmberg <ja...@gmail.com>.
You should really review some of the available example. This one:
camel-example-spring
<https://github.com/apache/camel/tree/master/examples/camel-example-spring>
might help. Also, a review of Spring basics sounds like it would be
helpful.
--
View this message in context: http://camel.465427.n5.nabble.com/How-can-i-use-CDI-with-the-Camel-Context-tp5767375p5767426.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How can i use CDI with the Camel Context
Posted by kikou1984 <hi...@atos.net>.
I have tried to add to the tag beans.
xsi:schemalocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"
and i add @Named to the Interface DateBusinessManager.
Named
public interface DateBusinessManager {
/**
*
*
* @param date
* @return
* @throws DateBusinessException
*/
DateCalendar findDate(final java.util.Date date) throws
DateBusinessException;
Nothing change... :(
--
View this message in context: http://camel.465427.n5.nabble.com/How-can-i-use-CDI-with-the-Camel-Context-tp5767375p5767382.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How can i use CDI with the Camel Context
Posted by kikou1984 <hi...@atos.net>.
Hi Claus,
So how i can make CDI with Spring Context ?
Thxs.
--
View this message in context: http://camel.465427.n5.nabble.com/How-can-i-use-CDI-with-the-Camel-Context-tp5767375p5767380.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How can i use CDI with the Camel Context
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
No <camelContext> is a spring based CamelContext.
On Thu, May 21, 2015 at 11:36 AM, kikou1984 <hi...@atos.net> wrote:
> Hi,
>
> I m using camel version 2.10.0.
>
> In my route spring XML , i want to use the CamelContextCDI instead of the
> DefaultCamelContext.
>
> How can i do it ?
>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:context="http://www.springframework.org/schema/context"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
> <import resource="classpath:/suivi-import-jms.xml" />
> <bean id="InitLcl" class="net.InitLCLBean" />
> <bean id="CtrlCB2A" class="net.CtrlCb2aLclBean" />
>
> <camelContext id="TM-UNL-TEST"
> xmlns="http://camel.apache.org/schema/spring" >
>
> is there a way to change the DefaultCamelContext, or to specify to the a
> bean that it must run with CDI container.
>
> In this bean id = "CtrlCB2A", i have the CDI.
>
> public class CtrlContratBean {
>
> @Inject
> DateBusinessManager dateBusinessManager;
>
> /**
> * Bean Ctrl Contrat
> *
> * @param exchange
> * @return
> */
> public List<ContratControllable> ctrlContrat(final Exchange exchange) {
> }
>
> And the value of dateBusinessManager still null , may be is there a way to
> make like :
> <cdi-bean id="CtrlCB2A" class="net.CtrlCb2aLclBean" />
>
> thxs for help, i really don t know to run CDI with camel.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-can-i-use-CDI-with-the-Camel-Context-tp5767375.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/