21

Where can I find OSGi bundles for Spring 4? I checked http://ebr.springsource.com/ but can only find Spring 3.2.x and the artifacts in Maven Central are not bundles.

Clarification

I'm not looking for Spring DM or similar. I'm looking for the "Spring Framework" JARs (spring-core, spring-beans, spring-context, …) as OSGi bundles. I'm not trying to create an application context in an OSGi environment. I just need the (exception) classes in an OSGi environment.

Philippe Marschall
  • 4,452
  • 1
  • 34
  • 52
  • This thread http://www.theserverside.com/discussions/thread.tss?thread_id=71606 suggests it all moved to http://www.eclipse.org/gemini/ a while ago. – pd40 Jan 24 '14 at 18:26
  • 1
    The way I read it that was Spring DM. That's not what I'm looking for. I'm just looking for spring-core, spring-context, spring-beans, … OSGi bundles. – Philippe Marschall Jan 24 '14 at 19:30
  • Good question. I found a list of repos here https://www.versioneye.com/java/org.springframework:spring-core/4.0.0.RELEASE. Seems after 3.2.5 the bundles are not there. – pd40 Jan 25 '14 at 12:38
  • That spring ebr repo is going away (look at the FAQs). I guess you can "osgify" your own bundles :) Just create a POM with say spring-core dependency then using the bnd plugin private-package everything. – codesalsa Jan 28 '14 at 17:28

5 Answers5

17

Spring will NOT support any further releases as OSGi bundles. The official support has been stopped with spring 3.2.4 (although you could find 3.2.5 artifacts here, contradicting the statement made in the Eclipse Forum)

Glyn Normington from Spring source acknowledged that in several places, see here:

However, there is hope. On the Karaf - dev list, one can read that they intend to support spring libraries in the ServiceMix project. Details in the entire thread see here.

Mirko Jahn
  • 1,282
  • 1
  • 9
  • 15
15

I found ServiceMix had provided OSGi-fy Spring bundles up to ver. 4.1.4, http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.spring-aop/

I tried it in my osgi Bundle project, to set dependeny like that :

 <dependency>
        <groupId>org.apache.servicemix.bundles</groupId>
        <artifactId>org.apache.servicemix.bundles.spring-core</artifactId>
        <version>4.1.1.RELEASE_3</version>
 </dependency>

Run in Felix a found sprint bundles are activated :

START LEVEL 1
 ID|State      |Level|Name
...
5|Resolved   |    1|Apache ServiceMix :: Bundles :: spring-expression (4.1.1.RELEASE_3)
6|Active     |    1|Apache Felix Gogo Command (0.14.0)
7|Active     |    1|Apache Felix Gogo Runtime (0.12.1)
8|Active     |    1|Apache Felix Gogo Shell (0.10.0)
...
10|Active     |    1|Apache ServiceMix :: Bundles :: spring-context (4.1.1.RELEASE_3)
11|Active     |    1|Apache ServiceMix :: Bundles :: spring-core (4.1.1.RELEASE_3)
.... 

But in it's latest release 5.4.0, ServiceMix only include spring 3.2.11.

Is there any risk when use spring 4.1.1 in my OSGi environment?

Allen
  • 569
  • 9
  • 22
  • I have found a problem about use Spring in OSGi environment.Spring Couldn't load schema 'http://www.springframework.org/schema/beans/spring-beans-4.0.xsd' resource embedded in spring bundle.XmlBeanDefinitionStoreException will occur when create ClassPathXmlApplicationContext without internet connection.Are there any way to deal with this problem? – Allen Apr 30 '15 at 02:14
13

Spring source stopped creating jars with OSGI heaaders last year: http://www.infoq.com/news/2012/10/spring-osgi-gradle/

I do not think you will get an official maven repo containing OSGI bundles for spring. We use http://ebr.springsource.com/ frequently for OSGI bundles, but even that does not contain any version after 3.2

Could not add as comment due to low repo, hence adding as answer.

6ton
  • 4,174
  • 1
  • 22
  • 37
6

I must say that migrating Spring to OSGi is still live in Apache ServiceMix. Get the latest(4.0.2.RELEASE) Spring artifacts with OSGi-enabled manifest from maven repo

daizhuoxian
  • 421
  • 6
  • 8
0

its a little bit tricky to find, here is the link for the OSGi bundle

http://docs.spring.io/downloads/nightly/release-download.php?project=OSGI

and for all spring projects

http://docs.spring.io/downloads/nightly/release-download.php

sophia
  • 21
  • 1