What is correct path for creation of micro services in Java? Spring Boot or OSGI
Asked Answered
M

3

8

I found a book "Spring DM in action". When I started to check the latest release of Spring for OSGI, I found out that Spring has discontinued this project.

As I have some experience of developing in Spring, I would like to understand should I continue to read about Spring and OSGI or switch to Spring Boot as way of creating modular applications?

Magnesium answered 2/3, 2015 at 10:14 Comment(4)
Spring DM is called Eclipse Virgo now. However, you should read the following blog post: blog.osgi.org/2014/09/… and leave Spring like technologies behind if you want to use OSGi.Bachman
Thank you for answer. Does I understood correctly that if I am a Spring fan I should forget about OSGI as a way of creating modular system and simply relay on Spring Boot for that?Magnesium
I was a Spring fan as well. It just does not work well with OSGi. I do not think you should forget about OSGi. You should not use the two technologies together. In OSGi, use a different component model (like Declarative Services) that is designed to work well within a modularized environment. In my experience, the switch is painful a bit in the beginning, but I would never go back to the Spring based monoholitic world.Bachman
@BalazsZsoldos I think spring dm is not worth the work if you don't need it but still has its use cases.Benitobenjamen
B
7

I've wanted to write a comment, but it didn't give me enough characters.

If you need the modularization and dynamic of OSGi, spring DM (now Gemini Blueprint) is a nice technology. We used it to create a high performance message oriented middleware with a plugin-infrastructure. The plugin-infrastructure was needed, cause the customer wanted to be able to add/replace/update modules and change routes via a web-interface at runtime. Each message also was transformed via 0-N groovy-scripts (stored in db, changeable on runtime). The processing engine was based on spring batch and spring integration.

So if you have a real use cases for OSGi, it can be a nice technology.

But most of the time people tried to use it, to separate the layers of a monolithic webapplication, which is not useful and gives you more work than profit. Once i saw an approach where a developer used OSGi to separate each group of his domain-model into a small module. This harms your application-design more than you can profit from, cause the profit is null.

Also, the book might be a nice idea to give you a different approach on "how to develop" software.

Benitobenjamen answered 2/3, 2015 at 22:39 Comment(0)
R
1

to the title question: "OSGi" for sure. An OSGi service is a very (the most?) natural candidate for the microservice moniker.

to the content of your post:

I have to jump in here, and say "both." OSGi, IMHO, is the best thing to happen to Java, since... well, maybe ever. Why? It begs you to follow better design practices, by facilitating the production of smaller, more modular pieces of code.

I love spring-boot as well, but I find it more suited to (read, "awesome for") writing client-side applications.

To the point about your experience with Spring--don't be afraid. If you're accustomed to spring XML configurations, you'll find that the blueprint syntax is, in most cases, identical... and you can still make extensive use of the various spring pieces within an OSGi-leveraging system.

FYI - I'm speaking from the standpoint of having developed several large-scale systems rooted in OSGi (and also a few forays into the wilds of the typical WAR/servlet deployments)

Ruggiero answered 14/10, 2015 at 12:33 Comment(0)
L
-1

The issue is that those are two totally different concepts of making modular apps.

OSGI is a huge system that sits much lower than boot, or spring. It gives you a different set of tools for modularizing application and sets very different challenges while developing.

Read what exactly is OSGI, what is Boot and what problems they solve. If after reading you don't know which tool to pick, go for Boot.

Lazulite answered 2/3, 2015 at 22:29 Comment(2)
With "boot" did you mean spring boot? How does the module approach of spring boot work different compared to modularization of "normal" spring applications?Benitobenjamen
Yes, I meant Spring Boot. There is no difference really. Question was about Boot so I assume that either someone is trying out new technology or trying to achieve modularity by having a lot of REST end points. Regardless of which is the case it's couple of days, at least, to understand requirements and constraints.Lazulite

© 2022 - 2024 — McMap. All rights reserved.