-2

I'm on the way to build a modular Java web project with some pluggable modules - like Jira and Confluence for example. My first thought was to build a project with Spring and OSGi, I started finding a workable OSGi framework that can suit Spring. It led me to Spring Dynamic Module (SDM) and Gemini Blueprint (GB). SDM is dead and GB is not popular - I even can't find any tutorials (work with Spring). I'm thinking of an alternative way but I don't have much experience in this area. Does anyone have any suggestions for my project? We can leave OSGi, even Spring behind. Any helps is appreciated.

Thank you.

3
  • 1
  • I don't ask for a specific solution, or how can I write it. Even I don't need a system design I can do it by myself. What I'm confusing here is a suggestion? Like I can try Spring alter for Quarkus, etc. Does it make sense?
    – Jack
    Commented Apr 3, 2021 at 3:04
  • Suggestion are considered inviting opinions. I guess you might want to ask something along the line : in 2021, what standard solution that exist in Java to make a pluggable application like Jira/Confluence. You might want to describe a bit more what kind of application and plugin you're thinking of to have more accurate answers and be a bit less broad. If you do, edit your post to reflect this.
    – Walfrat
    Commented May 7, 2021 at 9:25

2 Answers 2

0

I've used the following approach for a maven+JavaEE project (with Thorntail, now called Quarkus), but I'm sure it is possible to do so for Spring as well.

You split your modules in two different maven projects: interfaces and implementations.

Let's say you want to have a module "Authentication" with OAUTH2 as implementation. You'll have a authentication-interface and a authentication-oauth2 project. In the interfaces you have actually only interface classes and definition of classes used as parameters/return values for your interfaces.

You have then a main maven project, where actually the initialisation of your Spring application takes places. It will act as an "Orchestrator". This project will have as hard dependency only the "authentication-interface" artifact and will use the ServiceLoader approach to load an actual implementation of your interface(s). For this to work, the "authentication-oauth2" JAR must be available in the classpath/modulepath of your application at runtime.

0

A viable alternatively to OSGi or to Java 9 (project Jigsaw) is a SOA architecture based on micro services. It's a lot to detail about this architecture type and I won't go through it, I'm just going to sketch a high overview. Design the application domain to be agnostic of business domain (have a peek to entity attribute value model for details), design the business model based on strategy design pattern and use abstract factories to provide business model's dependencies. Implement a solution to leverage the dynamic selection of dependencies at runtime either based on business domain details or based on user choice or based on external configurations (i.e. configuration files).

Oh... and one more thing, mind the dependencies that is better not to be dynamic.

Not the answer you're looking for? Browse other questions tagged or ask your own question.