Hi,

just some comments from the peanut gallery :-)

If you just want to wire services between different bundles, stick with DS.
If you also want to have the full Context and Dependency injection stuff
within your own bundle, for example some inner bundle bean wiring.
In that case go with Pax-CDI.
If you want to have servlets combined with services sometimes DS is enough.
If you want to have a full-blown WAR with lot's of different stuff in it,
Pax-CDI might be the solution, to reference external services.

So this solely depends on the use-case and how good you are in cutting
dependencies.

regards, Achim



2017-03-06 11:04 GMT+01:00 erwan <[email protected]>:

> Hello,
> I'm new to osgi world (coming from a JEE bck) and trying to use pax-cdi at
> first to manage injection.
> I have 3 bundles
> Bundle A declares an interface:
> /package com.eg;
> public interface Itf {
>         public void PrintITf();
>
> }/
>
> with Manifest generation using maven:
> <Export-Package>com.eg*</Export-Package>
>
>
> Bundle B implements this interface:
> /package com.eg.impl;
> public class ItfImpl implements Itf {
>
>         public void PrintIFy() {
>                 System.out.println("Hello");
>         }
> }/
>
> <Import-Package>
> com.eg*,*
> </Import-Package>
>
> Bundle C is trying to inject Itf (as it can be done using JEE):
> /@Inject
>         private Itf itf;
>         public void setItf(Itf itf) {
>                 this.itf= itf;
>         }
>
>         public Use() {
>                 itf.PrintIFy();
>         }/
> <Import-Package>
> com.eg*, com.eg.impl*, *
> </Import-Package>
> <Require-Capability>
> osgi.extender;
> filter:="(osgi.extender=pax.cdi)",
> org.ops4j.pax.cdi.extension;
> filter:="(extension=pax-cdi-extension)"
> </Require-Capability>
>
> It doesn't seem to work as I always get NullPointerException starting
> bundle
> C.
>
> is this a classical use case in OSGI framework?
> Do you think I should change the way I split these 3 bundles (moving
> interface and implementation in the same bundle)?
>
> I also tried with blueprint without being able to do it as well...
> thanks for your help
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.
> com/Multiple-bundles-dependencies-injection-pax-
> cdi-or-blueprint-tp4049756.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Reply via email to