Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSGi: Does Blueprint replace Declarative Services?

Tags:

The new R4.2 spec for OSGi describes the Blueprint service, for dependency injection and service wiring.

Does Blueprint replace Declarative Services (which is still part of the spec, as well), or are they intended to work together?

Is Blueprint already available for the popular implementations (Felix and Equinox)?

like image 822
Thilo Avatar asked Oct 19 '09 06:10

Thilo


People also ask

What is OSGi Declarative services?

OSGi Declarative Services (DS) uses the XML configurations to manage component dependency injection in the OSGi Environment. To avoid old XML configuration, we have OSGi Declarative Services Annotations. Usage of annotation are very simple and simply define in the java classes wherever it requires.

How do you declare OSGi declarative services?

OSGi declarative services are the OSGi way to handle the instantiation problem: the fact that we want to code to interfaces, but we need some way to instantiate classes and some way to provide some concrete instance of an interface in order for the parts of our modular application to work together.

What capability does OSGi component @component provide?

The @Component annotation makes the class an OSGi component. Setting a service property to a particular service type in the annotation, allows other components to reference the service component by the specified service type.


1 Answers

I asked myself the same question and while discussing this with others involved in the topic, the tenor was that although the two are overlapping to some degree, the use case when to use which is pretty different. DS is a light weight solution to avoid Activators and model service dependencies declaratively. BP is basically a DI container targeting enterprise deployments. It is also more common for "regular" Java developers not that familiar with the dynamic nature of OSGi (hiding a lot behind proxies).

Implementation wise, there are two projects working on it (all of them are container agnostic and not officially released). Spring DM 2.0 is going to provide an implementation (2.0.0.M1 already contains a working implementation) as well as Apache as part of its geronimo project (slideshow).

like image 126
Mirko Jahn Avatar answered Mar 13 '23 15:03

Mirko Jahn