Modular Java – Book Review
Some weeks ago, I finished “Modular Java – Creating Flexible Applications With OSGi and Spring”, it’s time to do a little review now. This book is an excellent introduction to the creation of modular applications in Java. It introduces all the main concepts of OSGi technology, Spring Dynamic Modules and tools that make the development of OSGi applications easier.
The first chapter introduces the concept of modularity and explains how OSGi solves the problem. The main characteristics of the technology are also described. The next chapter lists the main OSGi containers and we create the first Hello World using OSGi. Next we improve this simple program using an OSGi service.
After that the third chapter introduces the application “Dude, Where is my Jar ?”. This application is a simple web program allowing a developer to search for a jar file in Maven repositories. This application is used in all the following chapters. The chapter also shows how the Pax tools can make the development of OSGi applications easier.
In the next chapter, we create the first bundle of the application. With that bundle we see how to work with non-bundle dependencies. And in the next one, we create the services of the application and see how to publish and consume services. After that, it’s time to use Spring Dynamic Modules: we see how to publish and consume services with Spring.
In the seventh chapter, we develop the web bundle. For that, we include Tomcat or Jetty in the form of OSGi Bundles. We also see the differences between a simple bundle (jar) and a web bundle (war). In the next, we see how to extend an OSGi bundle using fragments. With that, we see how to separate the JSP part of the application.
The last two chapters are about deployment in the production of an OSGi application and the services offered by the OSGi standard (logging, admin, console, …).
In conclusion, this book will allows you to
start developing applications using OSGi. It’s really comfortable to
follow the development of a simple application throughout the entire book, and improve it with each technology concept. But I think it’s
not a very good idea to use that log the Pax Tools. We quickly loose
OSGi with Pax. It’s quite interesting to know how to use Pax (I use it
everyday), but when we start, it’s better to see the basic concepts
And more, the Maven output, is almost entirely displayed. This not really useful to see that every time when it’s not errors, warning or important informations. But nevertheless, the reading of the book is really comfortable and fluid.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)