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.

相关文章

这篇文章主要介绍了spring的事务传播属性REQUIRED_NESTED的原...
今天小编给大家分享的是一文解析spring中事务的传播机制,相...
这篇文章主要介绍了SpringCloudAlibaba和SpringCloud有什么区...
本篇文章和大家了解一下SpringCloud整合XXL-Job的几个步骤。...
本篇文章和大家了解一下Spring延迟初始化会遇到什么问题。有...
这篇文章主要介绍了怎么使用Spring提供的不同缓存注解实现缓...