Looking at the weld-osgi project (https://github.com/mathieuancelin/weld-osgi) I've been thinking how this would ideally work in AS7.
So I started writing a little demo that does what I think would be a nice place to get to. It contains the following components:
- An API OSGi bundle. This bundle contains 2 interfaces which are shared by all the other components.
- A provider OSGi Bundle. This bundle provides an implementation of intfA and registers that with the OSGi Service Registry.
- A .war file. This war file has a servlet that uses CDI to inject intfA into it. It also provides intfB through CDI. The servlet uses a properietary AS7 manifest header 'Dependencies' to allow it to load the interfaces from the api-bundle.
- A consumer OSGi Bundle. This consumer looks up implementations of intfB in the OSGi Service Registry and invokes on it.
http://community.jboss.org/servlet/JiveServlet/downloadImage/2-604941-16366/450-203/cdiosgidemo.png
So the servlet has a dependency on an OSGi service, and the consumer-bundle has a dependency on a CDI bean provided in the .war file.
The code for the demo is here: https://github.com/bosschaert/coderthoughts/tree/master/CDI
Just run mvn install to build it all.
The question is: what needs to be done to get this demo to work?