[weld-dev] CDI+OSGI: bundle packages scope
Charles Moulliard
cmoulliard at redhat.com
Mon Jun 1 02:48:43 EDT 2015
Hi,
Why don't you import the package ("com.example.thirdpackage") within
your bundle Bundle A too ?
Regards,
Charles M.
On 30/05/15 14:53, Александр Свиридов wrote:
>
> I use javase and solution osgi (felix)+cdi(weld)+paxcdi. I have two
> bundles A and B. Bundle B is a lib bundle.
>
> In bundle A I have one class and one package.
>
> |package com.example.firstpackage;import com.example.secondpackage.Class2;publicclassClass1{@InjectprivateClass2 class2;}|
>
> In bundle B I have two classes and two packages
>
> |package com.example.secondpackage;import com.example.thirdpackage.Class3;publicclassClass2{@InjectprivateClass3 class3;}|
>
> and
>
> |package com.example.thirdpackage;publicclassClass3{....}|
>
> I install and start both bundles.
>
> The problem - pax (or weld) for injecting in classes of bundle A scans
> only those packages which are imported for classes IN bundle A. In my
> example - CDI for injecting in Class1 Class2 will scan
> com.example.secondpackage of bundle B. However, it will throw
> exception as Class2 needs Class3 but com.example.thirdpackage is not
> scanned for bundle A (as it's not imported!!!).
> com.example.thirdpackage is only scanned for bundle B but, as I
> understand every bundles for cdi has its own scope. How to fix it?
>
>
>
>
> --
> Александр Свиридов
>
>
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20150601/3fbd1bc2/attachment.html
More information about the weld-dev
mailing list