1.2 Spring DM concepts
Prev | 1. Concepts | Next

## 1.2 Spring DM concepts

Spring DM is a project which enables services to be published and consumed using descriptions written in XML. Web Server has Spring DM built-in.

The XML descriptions reside in files with extension `.xml` in the bundle’s `META-INF/spring` sub-directory.

To publish a service, an `<osgi:service>` tag is used, specifying the implementation class of the service and the interface class to be used. Spring DM constructs an instance of the implementation class and publishes that instance in the OSGi service registry under the interface when the bundle is started.

To consume a service, an `<osgi:reference>` tag is used and the service may be passed into other Spring beans using Spring’s dependency injection facilities.

Spring DM automatically creates proxies for OSGi services so that the actual service object may come and go at runtime. If a service disappears, any proxies to the service will wait for the service to re-appear. This effect is known as damping.

When a bundle is started, Spring DM builds the application contexts specified by the XML descriptions, creates proxies for the specified services, and publishes the specified services to the OSGi service registry.

When a bundle is stopped, Spring DM retracts any services it published on behalf of the bundle and closes the bundle’s application contexts. Web Server turns off damping of a service proxy while the proxy’s application context is being closed.

(Spring DM has been contributed to Eclipse as the Gemini Blueprint project.)

Prev | Up | Next
1. Concepts | Home | 1.3 Grouping bundles in Web Server