简体   繁体   English

构建非常简单的极简Java插件容器

[英]Build Very Simple Minimalist Java Plugin Container

I'm working on an app where I'm in need of building a very small and minimal plugin container. 我正在开发一个需要构建非常小巧的插件容器的应用程序。

Below are the things I'm trying to achieve. 以下是我要实现的目标。

  1. Application is divided into smaller plugins packaged as Jars. 应用程序分为打包为Jars的较小插件。
  2. Plugin container should get them and load all jars. 插件容器应获取它们并加载所有jar。
  3. Each plugin should not interfere with other plugins and should run on it's own along with it's dependant libraries. 每个插件都不应干扰其他插件,并应与其相关的库一起运行。 Basically all plugins should be isolated at runtime. 基本上所有插件都应该在运行时隔离。

I tried using OSGI container, but it adds high complexity. 我尝试使用OSGI容器,但是它增加了很高的复杂性。 Also many of the third party libraries which are not compatible with OSGI creating problem which is taking lot of time to debug. 同样,许多与OSGI不兼容的第三方库也产生了问题,这需要大量时间进行调试。 Also checked out Spring Boot, JPF etc. and not very interested. 还签出了Spring Boot,JPF等,并不太感兴趣。 So thought of using very small homegrown plugin framework. 因此考虑使用非常小的本地插件框架。

I have no clue on how to do and where to start. 我不知道如何做和从哪里开始。 Please anyone can point me in right direction where I can get detailed information on this. 请任何人都可以向我指出正确的方向,以便我可以获取有关此方面的详细信息。

Thank you in advance. 先感谢您。

If you truely want something minimalistic, have a look at Java's ServiceLoader class. 如果您确实想要一些简单的东西,请看一下Java的ServiceLoader类。 Here's a tutorial . 这是一个教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM