• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown

Accessing OSGI Bundles in Spring Boot

Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have been writing some microservices  in Spring boot. We have an existing application running in an OSGI container and I need to some few of its components/bundles in spring boot. I know we cannot access the components running in an OSGI container directly however my main question is, can I take those bundle jars and add it to my Spring Boot dependency? Will Spring Boot be able to load the bundles as a regular jars and can I access the api's in it?

I tried referring these bundles already in my pom.xml of Spring Boot application, but no luck. Was wondering is this even possible?

Saloon Keeper
Posts: 26540
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spring Boot is basically a pre-packaged webapp server with deployed webapp.

OSGi is, as you know, quite a different sort of container.

You can use the same classes in both, but the webapp server doesn't automatically do the things that OSGi does, so you'd be sharing the class code and nothing else. Depending on your build system, it might be perfectly manageable to be building the same classes for inclusion of both targets. Doing it manually would be a bit messier, though.

You might want to consider an OSGi container that can act as a webapp server in its own right rather than using Spring Boot - get one container for the price of 2. For example, Apache ServiceMix.

Because the OSGi instances and webapp instances are going to be running in hermetic classpaths, however, directly sharing objects between your OSGi code and webapp code might still be a problem, but there are channels whereby an OSGi app and webapp can communicate between the 2, like web services do.
    Bookmark Topic Watch Topic
  • New Topic