An example of building a spring-boot application extendable with plugins.
This approach has some weak points:
- There is not separation between the plugins, its just all on one classpath at runtime. So be careful if you import dependencies in a plugin - they my conflict with the ones from another plugin
- You can only install plugins before you start the application, not at runtime
- You can not remove or update plugins at runtime
But if you can live with this, it has some advantages too:
- No osgi runtime needed
- One plugin can totally use the other. An extension of the database like the team plugin is not possible with osgi bundles AFAIK
- Simply use spring in all parts of your application
This demo uses vaadin for the UI and spring-data-jpa with geodb and hibernate for persistence.
- Clone the reopsitory
- Build the stuff
mvn install
- Start the application:
cd application/target
and then:java -jar application-0.0.1-SNAPSHOT.jar
Now the application starts just with the people plugin. To add the team plugin:
- Stop the application
- Create a folder called
lib
next toapplication-0.0.1-SNAPSHOT.jar
and placeplugin-team-0.0.1-SNAPSHOT.jar
in it. - Start the application again
Now the application starts with both plugins.
- plugin
- A pom with the dependencies need and common classes for all plugins. In this case just the MenuEntry stuff
- application
- This contains the spring-boot application
- plugin-*
- This modules contain the implementation of the modules.