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

我使用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个项目.

您很可能必须自己重新实现.也许您应该研究现有的插件系统实现,例如实现OSGiApache 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值