You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kalber <Ka...@swslt.com> on 2016/04/26 14:18:16 UTC

CDI.current() with 2.17.0

Hi,

i must create 'FileIdempotentRepository' as managed named beans
programmaticly.


For this i tried to use CDI.current().getBeanManager().createBean, but
CDI.current is null.


This are dependencies i set:
   <dependency>
            <groupId>org.apache.deltaspike.cdictrl</groupId>
            <artifactId>deltaspike-cdictrl-weld</artifactId>
            <version>1.6.0</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.weld.se</groupId>
            <artifactId>weld-se</artifactId>
            <version>2.3.3.Final</version>
        </dependency>

It's possible to use javax.enterprise.inject.spi.CDI ?




-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/CDI-current-with-2-17-0-tp5781717.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CDI.current() with 2.17.0

Posted by kalber <Ka...@swslt.com>.
Thanks John,

i will test it soon, for a surgical intervention on the eyes i'm
offline until monday.


Karlheinz

On Wed, Apr 27, 2016 at 2:58 AM, John D. Ament-2 [via Camel]
<ml...@n5.nabble.com> wrote:
> So here's a simple project.  Its working fine when I run it, so if you can
> point out whats different about your setup.
>
> https://github.com/johnament/camel-cdi-annotated
>
> John
>
> On Tue, Apr 26, 2016 at 6:34 PM John D. Ament <[hidden email]> wrote:
>
>> Could you provide a bit more context about how you're calling
>> CDI.current?  Like maybe the full class or an example class?
>>
>> I'll try to put together an example to show it working, may be something
>> to work through.  I suspect that the bean-discovery-mode=annotated is the
>> problem, if you're calling within a static method in SE mode that may not
>> resolve properly.
>>
>> John
>>
>>
>> On Tue, Apr 26, 2016 at 9:21 AM kalber <[hidden email]> wrote:
>>
>>> yes,
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
>>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
>>>
>>> http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd"
>>>        version="1.2" bean-discovery-mode="annotated">
>>> </beans>
>>>
>>>
>>>
>>> -----
>>> kh
>>> --
>>> View this message in context:
>>>
>>> http://camel.465427.n5.nabble.com/CDI-current-with-2-17-0-tp5781717p5781724.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/CDI-current-with-2-17-0-tp5781717p5781759.html
> To unsubscribe from CDI.current() with 2.17.0, click here.
> NAML




-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/CDI-current-with-2-17-0-tp5781717p5781766.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CDI.current() with 2.17.0

Posted by "John D. Ament" <jo...@apache.org>.
So here's a simple project.  Its working fine when I run it, so if you can
point out whats different about your setup.

https://github.com/johnament/camel-cdi-annotated

John

On Tue, Apr 26, 2016 at 6:34 PM John D. Ament <jo...@apache.org> wrote:

> Could you provide a bit more context about how you're calling
> CDI.current?  Like maybe the full class or an example class?
>
> I'll try to put together an example to show it working, may be something
> to work through.  I suspect that the bean-discovery-mode=annotated is the
> problem, if you're calling within a static method in SE mode that may not
> resolve properly.
>
> John
>
>
> On Tue, Apr 26, 2016 at 9:21 AM kalber <Ka...@swslt.com> wrote:
>
>> yes,
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
>>
>> http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd"
>>        version="1.2" bean-discovery-mode="annotated">
>> </beans>
>>
>>
>>
>> -----
>> kh
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/CDI-current-with-2-17-0-tp5781717p5781724.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>

Re: CDI.current() with 2.17.0

Posted by "John D. Ament" <jo...@apache.org>.
Could you provide a bit more context about how you're calling CDI.current?
Like maybe the full class or an example class?

I'll try to put together an example to show it working, may be something to
work through.  I suspect that the bean-discovery-mode=annotated is the
problem, if you're calling within a static method in SE mode that may not
resolve properly.

John

On Tue, Apr 26, 2016 at 9:21 AM kalber <Ka...@swslt.com> wrote:

> yes,
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
>
> http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd"
>        version="1.2" bean-discovery-mode="annotated">
> </beans>
>
>
>
> -----
> kh
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/CDI-current-with-2-17-0-tp5781717p5781724.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: CDI.current() with 2.17.0

Posted by kalber <Ka...@swslt.com>.
yes, 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
                           http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd"
       version="1.2" bean-discovery-mode="annotated">       
</beans>



-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/CDI-current-with-2-17-0-tp5781717p5781724.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CDI.current() with 2.17.0

Posted by "John D. Ament" <jo...@apache.org>.
That should work without a hitch (CDI.current()).

Do you have a beans.xml file in the right location in your camel context?

John

On Tue, Apr 26, 2016 at 8:18 AM kalber <Ka...@swslt.com> wrote:

> Hi,
>
> i must create 'FileIdempotentRepository' as managed named beans
> programmaticly.
>
>
> For this i tried to use CDI.current().getBeanManager().createBean, but
> CDI.current is null.
>
>
> This are dependencies i set:
>    <dependency>
>             <groupId>org.apache.deltaspike.cdictrl</groupId>
>             <artifactId>deltaspike-cdictrl-weld</artifactId>
>             <version>1.6.0</version>
>         </dependency>
>         <dependency>
>             <groupId>org.jboss.weld.se</groupId>
>             <artifactId>weld-se</artifactId>
>             <version>2.3.3.Final</version>
>         </dependency>
>
> It's possible to use javax.enterprise.inject.spi.CDI ?
>
>
>
>
> -----
> kh
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/CDI-current-with-2-17-0-tp5781717.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>