Implementing dynamic plugins in Java

后端 未结 5 1829
心在旅途
心在旅途 2021-01-31 10:45

I\'d like to implement a dynamic plugin feature in a Java application. Ideally:

  • The application would define an interface Plugin with a method like
5条回答
  •  一整个雨季
    2021-01-31 11:44

    OSGI would be fine if you want to replace the plugins during runtime i.g. for bugfixes in a 24/7 environment. I played a while with OSGI but it took too much time, because it wasn't a requirement, and you need a plan b if you remove a bundle.

    My humble solution then was, providing a properties files with the class names of plugin descriptor classes and let the server call them to register (including quering their capabilities).

    This is obvious suboptimal but I can't wait to read the accepted answer.

提交回复
热议问题