微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐