Skip to content
Advertisement

Java Spring REST Controller classes as runtime plugins

currently I want to implement a plugin system into my spring application. The idea is that there is a main spring application which monitors a folder for new jar files. When I put a new jar file in the folder then the main appliation should automatically lift up the RestController classes for usage without downtime. In the plugin jar there is no main class or something like that.

Is this possible in Java Spring to start external RestController classes during runtime?

KR, BlackRose01

Advertisement

Answer

I’ve found a nice repository from tsarenkotxt about this topic. The abstract class is the “interface” for the plugin initialization class. The thread class is from the main application which monitors a directory.

KR, BlackRose01

Abstract class IPlugin

JavaScript

Thread PluginLoader

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement