Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Declarative Vs Bluprint Services in OSGi

What is the difference between Declarative and Bluprint Services in OSGi? as both are aim to achieve Dependency injection in osgi. Is blueprint services is alternative to declarative services? or bluprint services fills the limitations (if any) of declarative services?

like image 509
komal Avatar asked Dec 30 '09 10:12

komal


1 Answers

There isn't a trivial answer to that question, I'm afraid. I would recommend reading the specification of both to see the extent of the differences. Declarative Services is section 112 of the Service Compendium, Blueprint Container is section 121 of the same document. You can get the core and compendium documents here: http://www.osgi.org/Download/Release4V42

For me though, the most significant difference is that (in DS terms) a Blueprint service can be made active without the services it depends on being present. The container creates proxy services which block until an actual implementation is made available. I believe this is akin to Spring's approach and that people who are used to using Spring's IOC/DI approach will get Blueprint instantly, though I could not comment from personal experience having never used Spring or Blueprint (yet).

Since we are dealing with OSGi services it is possible to mix and match DS and Blueprint as you see fit. So far I haven't found a need to do anything more complicated than can be achieved with DS, so am not sure what use case the Blueprint Container specification meets, though from the spec it does look as though Blueprint provides quite a lot of functionality in order to make component development simple.

I believe it has been added primarily because J2EE developers will find it familiar, but that is just my opinion. :)

like image 79
brindy Avatar answered Oct 06 '22 16:10

brindy