What are they of each other?
The OSGi specification is composed of two separated parts: core and compendium.
The core part is the specification of a module system for Java. As such, the core specification has no relationship with the concept of DI.
The compendium part, on the other side, specifies a series of services that an OSGi container can provide. Among this services you'll find the "Declarative Services Specification" (OSGi Compendium Services, Chapter 112) that is the first attempt to bring the familiar concept of DI into OSGi. The idea is simple: since OSGi allows the developer to implement, define and register services, the Declarative Services Specification gives the developer the possibility to define a service dependent on a series of other underlying services. That's a particularly interesting (and hard) problem in OSGi, because services are by definition unreliable, and they can appear and disappear.
Beside the Declarative Services Specification, there are at least two other popular solution trying to provide a more powerful DI framework in OSGi:
It worth noting that the upcoming R4.2 version of the OSGi specification will contain a new compendium specification named Blueprint Services, that will provide a complete DI solution for OSGi based on the Spring DM framework (the Spring team has heavily contributed to this new specification)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With