Marco Ehrentreich wrote:you've talked about OSGi with Spring and the OSGi API itself in other posts. Does your book expect to use OSGi together with Spring or does it also explain how to build applications with pure OSGi? Or does it in your opinion even make sense to use OSGi without the benefits of the Spring framework?
I spend the first few chapters "Spring-free". It is quite possible to use OSGi without Spring and...surprise, surprise...it's not *that* hard.
But I don't present pure OSGi because I think it's a great way to develop OSGi-based apps. I present it so that the reader will understand what's going on under the covers of Spring-DM and to be able to work with native OSGi if the need arises.
In response to your last question: I personally wouldn't choose to do much OSGi without Spring-DM (or the OSGi R4.2 Blueprint Services, which is just a formal spec version of Spring-DM). But that's just a choice I make. There are other declarative OSGi models such as OSGi's DS (Declarative Services) and Apache Felix's iPOJO. Both of these, like Spring-DM, eliminate much of the need to work with the native OSGi API.
What's great about all of these options is that they all interoperate very well. A service published by Spring-DM can be consumed by native OSGi. A native OSGi service can be consumed by iPOJO. An iPOJO service can be consumed by Spring-DM. Once a service is published in the OSGi service registry, it's not all that important as to how it got there.