posted 7 years ago
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.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.