concept OSGi service registry in category spring

appears as: OSGi service registry, The OSGi service registry
Spring Dynamic Modules in Action

This is an excerpt from Manning's book Spring Dynamic Modules in Action.

As well as managing the creation of Spring containers, Spring DM also provides a convenient way to link bundles using the OSGi service registry. In any OSGi application, simply using package imports and exports isn’t sufficient because these only specify the behavior of class linkages within the application; they do nothing to manage the lifecycle of object instances created from these classes. This is what makes the OSGi service registry so essential—it provides a well-defined boundary through which object instances can be accessed while still maintaining appropriate class and lifecycle boundaries.

Furthermore, Spring DM brings its web support to OSGi, making it possible to deploy bundles as web applications to an embedded web container. We’ll see in this chapter how this web support is unique to an OSGi environment, because web bundles are treated like any other OSGi bundle and can consume services available in the OSGi service registry. At the heart of the Spring DM web support is its web extender, which contains a WAR deployer, which we’ll take a look at to see how it differs from a standard web deployer.

Figure 4.11. In the whiteboard pattern, the OSGi service registry acts as a middle tier to connect event listeners to event producers.

In the case of Spring-powered bundles, dependencies means that the application contexts of these bundles share some beans, thanks to the registering and consumption mechanisms of the OSGi service registry. Figure 4.1 illustrates this.