I want to implement plugin architecture in Spring Boot application. Let me explain my scenario. I have a main application, which starts the server, manages security, etc. The app is like the root of my final product which will include this root app and other plugins added to it.
Now, the plugins are Spring Boot application themselves, which I may add to the root app by dynamically searching for jars in the specific path or by added them to project dependency as library.
Plugins have their own configurations and are like apps running inside the main root app. Let's say if the root app runs the server, the plugin app may have all the controllers (endpoints), beans etc that provide functionality to my product.
This is the premise, now what I want to know is,
I am confused about the concept here, and how it can work. Any sort of help is appreciated. If there is some example that anyone can provide, that will be just wonderful.
A plug-in is a bundle that adds functionality to an application, called the host application, through some well-defined architecture for extensibility. This allows third-party developers to add functionality to an application without having access to the source code.
Spring Boot uses a hierarchical architecture in which each layer communicates with the layer immediately below or above it ( hierarchical structure).
The Spring Boot Maven Plugin provides Spring Boot support in Apache Maven. It allows you to package executable jar or war archives, run Spring Boot applications, generate build information and start your Spring Boot application prior to running integration tests.
Spring annotations present in the org.springframework.boot.autoconfigure and org.springframework.boot.autoconfigure.condition packages are commonly known as Spring Boot annotations. Some of the annotations that are available in this category are: @SpringBootApplication. @SpringBootConfiguration.
This post was 3 years ago. However, I'd like to answer this for someone who looking for a solution for a similar scenario. It seems that pf4j which is a plugin framework that is suitable for you. Beside supporting native app, it also has spring-pf4j, so you can use it into spring.
URL: https://pf4j.org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With