Bluprint declarative Vs services on OSGi

What is the difference between Declarative and Bluprint Services in OSGi? since both are aimed at achieving dependency injection in osgi. Are services an alternative to declarative services? or do bluprint services fill in the limitations (if any) of declarative services?

+4
source share
2 answers

No, there is no trivial answer to this 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 Compendium of Services, Blueprint Container is Section 121 of the same document. You can get the basic and composite documents here: http://www.osgi.org/Download/Release4V42

For me, however, the most important difference is that (in DS terms) the Blueprint service can be activated without the services on which it depends. The container creates proxy services that are blocked until the actual implementation becomes available. I find this to be similar to the Spring approach, and people accustomed to using the Spring IOC / DI approach will get Blueprint instantly, although I could not comment on personal experiences that Spring or Blueprint never used (yet).

Since we are dealing with OSGi services, you can mix and match DS and Blueprint as you see fit. So far, I have not found the need to do something more complex than can be achieved with DS, so I don’t know what option to use the Blueprint Container specification comes across, although from the specification it looks as if Blueprint provides quite a lot of functionality to simplify component development.

I believe this was added primarily because J2EE developers will find this familiar, but this is just my opinion. :)

+9
source

I understand that this is an old thread, but I think this question is still important.

I agree with those who said that BS is better at hiding the dynamic nature of OSGi than DS. In addition, it appears that DS is designed for inter-packet linking, while BS can be used to graph objects “for internal consumption”.

+1
source

All Articles