• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Accessing OSGI Bundles in Spring Boot

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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?

Thanks
Mehul
 
Saloon Keeper
Posts: 21941
149
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • 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.
 
After some pecan pie, you might want to cleanse your palatte with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic