4.2. A note on types of dependencies

There are two kinds of dependencies between various bundles: type dependency and service dependency. A bundle may depend on type exposed by another bundles creating type dependency. This dependency is managed through Import-Package and Export-Package directives in the OSGi manifest. This kind of dependency is similar to a jar file using types in other jar files from the classpath. However, as we've seen earlier, there are significant differences.

A bundle may also expose services (preferably using Spring Dynamic Modules for OSGi) and other bundles may use those services. If two bundles depend on the same service, both will be communicating effectively to the same object. More specifically, any state for that service will be shared between all the clients of that service. This kind of arrangement is similar to the commonly seen client-server interaction through mechanisms such as RMI or Web Services.