Spring framework download as OSGi bundles

2.4k Views Asked by At

I'm working myself into Spring for OSGi, aka Eclipse Gemini Blueprint.

Every tutorial or documentation I found mentions adding several bundles provided by Spring to my OSGi-container (like org.springframework.aop.jar). It was hard enough finding a download for the current Spring release, as it seems it is not directly provided on their homepage anymore (only maven links etc. and this is not an option for the current project). Especially every tutorial mentions, that this libraries are provided as OSGi bundles aswell.

In addition, the Spring Framework provides a number of bundles that are required to be installed as dependencies. As of release 2.5 of the Spring Framework, the Spring jars included in the Spring distribution are valid OSGi bundles and can be installed directly into an OSGi platform.

Source: http://www.eclipse.org/gemini/blueprint/documentation/reference/1.0.2.RELEASE/html/app-deploy.html

But all of the downloads I could find (e.g. http://maven.springframework.org/release/org/springframework/spring/3.2.5.RELEASE/) only contained normal jars, no OSGi bundles. Is the practice of providing OSGi-bundles discontinued as of Spring 3.x? How do I add the neccessary Spring dependencies to my project? Are the tutorials/documentations outdated?

I'm using the latest release of Gemini which is 1.0.2.

4

There are 4 best solutions below

2
sebplorenz On BEST ANSWER

You can use the Eclipse Maven Repository

<repositories>
<repository>
    <id>gemini-blueprint</id>
    <name>Gemini Blueprint</name>
    <url>https://repo.eclipse.org/content/groups/gemini-blueprint/</url>
</repository>
</repositories>

<dependencies>
<dependency>
    <groupId>org.eclipse.gemini.blueprint</groupId>
    <artifactId>gemini-blueprint-extender</artifactId>
    <version>2.0.0.BUILD-SNAPSHOT</version>
</dependency>
</dependencies>

The transitive dependencies of Blueprint Extender will contain all Spring stuff you need.

4
Christian Schneider On

I am a bit sceptic about Gemini Blueprint. Since VMware took over SpringSource they seem to have almost ceased their efforts into OSGi. Fortunately there is an alternative implementation from Apache Aries which is backed by IBM and some other companies.

You should also take a look at Apache Karaf. It comes with blueprint pre installed and allows to add a lot of other frameworks easily. I have done some tutorials that show how to use blueprint with several technologies like CXF, Camel, JPA.

2
Arie van Wijngaarden On

If your concern is simple dependency injection in an OSGi framework, I would suggest also looking at OSGi declarative services, like the Felix implementation, especially in combination with Bndtools or, if you are using PDE, a DS annotations processor which make it very simple to perform dependency injection via annotations. Overall, I find these solutions much more lightweight and simpler to get working than Spring/Gemini/Blueprint.

0
Martin Baumgartner On

If you need OSGi'ified Jars i would suggest to use the springsource enterprise bundle repository which could be found under: http://ebr.springsource.com/

The springsource ebr does not only offer osgi-enabled spring-jars, it also provides a lot of third party osgi libaries with an osgi-Manifest.MF file.

For example, it contains the OSGi comaptible Jar you mentioned in your post: http://ebr.springsource.com/repository/app/bundle/version/detail?name=org.springframework.aop&version=3.2.5.RELEASE&searchType=bundlesBySymbolicName&searchQuery=org.springframework.aop