加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

java-Spring Boot:在类路径更改时刷新应用程序上下文

发布时间:2020-12-15 01:17:32 所属栏目:大数据 来源:网络整理
导读:我使用Spring Boot的PropertiesLauncher和Loader-Path:插件清单条目构建了一个小型应用程序.在plugins文件夹中有几个jar文件,其中包含META-INF / spring.factories. 加载我的外部插件jar的配置可以正常工作. 现在,我想知道如果类路径上的某些内容发生更改,

我使用Spring Boot的PropertiesLauncher和Loader-Path:插件清单条目构建了一个小型应用程序.在plugins文件夹中有几个jar文件,其中包含META-INF / spring.factories.

加载我的外部插件jar的配置可以正常工作.

现在,我想知道如果类路径上的某些内容发生更改,是否以及如何刷新应用程序上下文.例如,删除或添加外部插件jar.

我已经看过SpringApplicationRunListener了,但是我想我不能通过此类来实现.

有没有想法,以及如何实现?

最佳答案
对于普通的Spring,在类路径上更改jar通常意味着完全重新启动应用程序.在Spring Framework提供的类路径中,没有开箱即用的机制来支持运行时更改.

在2009/2010年,有Spring Dynamics Modules个项目,但有it seems abandoned now个项目.

您很可能必须自己重新实现.也许您应该研究现有的插件系统实现,例如实现OSGi的Apache Felix:

Apache Felix is a community effort to implement the OSGi Framework and Service platform and other interesting OSGi-related technologies under the Apache license. The OSGi specifications originally targeted embedded devices and home services gateways,but they are ideally suited for any project interested in the principles of modularity,component-orientation,and/or service-orientation. OSGi technology combines aspects of these aforementioned principles to define a dynamic service deployment framework that is amenable to remote management.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读