concept Require - Bundle header in category spring

appears as: Require-Bundle header, Require-Bundle headers
Spring Dynamic Modules in Action

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

The Import-Package and DynamicImport-Package headers allow components to specify which packages they need to import for their dependencies to be satisfied. OSGi also provides another approach, based on the Require-Bundle header, to directly import all the exported packages of a component.

As with the previously described headers for consuming packages, the value of this header contains a list of element names, but this time they aren’t package names but rather bundle symbolic names. The matching between exported and imported entities is still based on attributes, but only one standard attribute is defined by the OSGi specification: the bundle-version attribute. The bundle-version attribute uses the same semantics as the version attribute of the Import-Package header and specifies the component version of the dependency. For more details, see section 2.2.5. The following snippet shows a simple use of the Require-Bundle header.

Manifest-Version: 1.0
(...)
Import-Package: javax.servlet;version="2.5.0",
javax.servlet.http;version="2.5.0",
javax.servlet.jsp;version="2.0.0",
(...)
Require-Bundle: com.springsource.javax.servlet.jsp.jstl;
bundle-version=1.1.2,com.springsource.org.apache.taglibs.standard;
bundle-version=1.1.2

Import-Package and Require-Bundle headers can both be specified in the manifest configuration of a bundle, but the Import-Package header takes priority over the Require-Bundle header. Moreover, packages that are implicitly exported by a Require-Bundle header and imported via an Import-Package header must not be treated as split packages.