2

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.

sina
  • 1,817
  • 1
  • 18
  • 42

4 Answers4

2

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.

sebplorenz
  • 999
  • 2
  • 10
  • 17
  • No maven for this project, I specified that in the question. – sina Dec 02 '13 at 10:11
  • 1
    Yes, but you could use Maven to get all the dependencies you need. Just create an extra maven project to download all the dependencies and let maven copy all of it to a directory of your choice. Then you have all the libraries you need in the correct version. I faced the same problems when I started with Gemini Blueprint and this is the easiest way to deal with it imo. – sebplorenz Dec 02 '13 at 15:05
2

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

Martin Baumgartner
  • 3,524
  • 3
  • 20
  • 31
1

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.

Christian Schneider
  • 19,420
  • 2
  • 39
  • 64
  • Thanks for the hint on Gemini, I will do further research on the future of it. My thoughts were that as it is part of the Eclipse Foundation now, the future of it should be pretty stable. The main reason I am looking into Spring/Blueprint is dependency injection. Any framework will do, as long as it is able to inject beans based on a web-session scope (I'm building a web application and need it to smoothly handle multi-user capabilities). Session Scope is not part of the official Blueprint specification (Gemini provides it though). How is that with Apache Aries? – sina Nov 29 '13 at 09:25
  • 1
    I have not used scopes till now. As far as I know session scope is not yet implemented in aries blueprint but I may be wrong. Btw. One other thing you might want to look into is CDI on OSGi. I am currently preparing a tutorial for it. Looks promising. I already have a working example: https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist-cdi – Christian Schneider Nov 29 '13 at 10:57
  • Looks promising indeed but I guess a pure open source project not backed by any company or foundation is not an option for this project (no judgement of your efforts of course). We have to stick with established frameworks for this one. Still I appreciate your inputs :) – sina Nov 29 '13 at 11:37
  • 1
    Pax cdi is just a small OSGi adapter. The real work is done by Apache OpenWebBeans or JBoss Weld depending on what you choose. So there are big organisations behind. Despite this it is probably too early to switch to it. – Christian Schneider Nov 29 '13 at 23:34
0

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.

  • I will look into that, but the main benefit I was hoping for is not dependency injection but beans with a scope based on web-sessions (to avoid the need to handle multitons all manually). This scope of course works with dependency injection - but not every dependency injection framework provides the feature to inject beans based on a session scope. – sina Dec 02 '13 at 10:14
  • Right. I think in that case the functionality provided by DS may not be sufficient. – Arie van Wijngaarden Dec 02 '13 at 11:10