【发布时间】:2019-01-03 04:56:18
【问题描述】:
我需要在运行时刷新我的应用程序上下文。为此,我正在执行以下步骤:
1. 在我的 OSGI 包之外创建新的 application-context.xml
2. 将旧应用 ctx 复制到新应用中,使用 InputStream inputStream = new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream("/META-INF/spring/application-context.xml"));
3. 刷新app ctx,即切换到新的,在bundle外创建
ApplicationContext ctx = new FileSystemXmlApplicationContext(newCtxPath);
((ConfigurableApplicationContext)ctx).refresh();
但我得到了
找不到 XML 模式命名空间的 Spring NamespaceHandler [http://www.springframework.org/schema/data/mongo]
http://www.springframework.org/schema/data/mongo
在我的 application-context.xml 中,我认为这不是问题,因为在编译期间,一切正常,当我在运行时尝试刷新 ctx 时会出现问题。
编辑# 当然,将旧的 ctx 文件复制到新文件是成功的,两个文件看起来完全一样。
【问题讨论】:
标签: spring mongodb osgi applicationcontext