使用插件扩展 Java Web 应用程序 [英] Extending Java Web Applications with plugins

查看:22
本文介绍了使用插件扩展 Java Web 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的这个 Web 应用程序已经变得一团糟,难以管理.

I have this web application that has grown to an unmanageable mess.

我想把它分成一个通用的框架"部分(仍然包括网页和图像等网络内容)和几个添加额外功能和屏幕的模块.我希望这种重构也可以用作第三方扩展的插件系统.

I want to split it into a common "framework" part (that still includes web stuff like pages and images) and several modules that add extra functionality and screens. I want this refactoring to also be useful as a plugin system for third-party extensions.

所有模块都需要是单独的部署单元,最好是一个 war 或 jar 文件.

All modules need to be separate unit of deployments, ideally a war or jar file.

我试图只制作几个常规的 war 文件,但是 Tomcat 保持(根据 servlet 规范)这些 war 文件彼此完全分开,因此它们不能共享它们的类,例如.

I tried to just make several regular war files, but Tomcat keeps (according to the servlet spec) these war files completely separate from each-other, so that they cannot share their classes, for example.

我需要插件才能看到主"类路径.

I need to plugins to be able to see the "main" classpath.

我需要主应用程序对插件进行一些控制,例如能够列出它们并设置它们的配置.

I need to main application to have some control over the plugins, such as being able to list them, and set their configuration.

我希望在插件本身(除非它们指定依赖项)和可能在同一 Tomcat 上运行的任何其他不相关的 Web 应用程序之间保持完全分离.

I would like to maintain complete separation between the plugins themselves (unless they specify dependencies) and any other unrelated web applications that may be running on the same Tomcat.

我希望它们以主"应用程序 URL 前缀为根,但这不是必需的.

I would like them to be rooted under the "main" application URL prefix, but that is not necessary.

我想使用 Tomcat(大的架构变化需要与太多人协调),但也想听听 EJB 或 OSGi 世界中的干净解决方案(如果有的话).

I would like to use Tomcat (big architectural changes need to be coordinated with too many people), but also to hear about a clean solution in the EJB or OSGi world if there are.

推荐答案

我一直在琢磨使用 OSGi 来解决您所描述的相同问题的想法.特别是我正在考虑使用 Spring 动态模块.

I have been tinkering with the idea of using OSGi to solve the same problem you are describing. In particular I am looking at using Spring Dynamic Modules.

这篇关于使用插件扩展 Java Web 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆