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?
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.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
After some pecan pie, you might want to cleanse your palatte with this tiny ad: