简体   繁体   English

运行时Spring应用程序上下文切换

[英]Spring Application Context Switch at Runtime

I'm wondering if it is possible to change which application context your app is using at run time. 我想知道是否有可能在运行时更改应用程序正在使用的应用程序上下文。

The use case would be: 用例为:

I have a GUI that allows you create queuing networks. 我有一个GUI,可让您创建排队网络。 It also allows you to select which simulation library you would like to use run the model you've just created. 它还允许您选择要使用哪个仿真库来运行刚刚创建的模型。 Each library has its own application context which says which castor mapping files to use for translation, how to instantiate beans etc.... 每个库都有其自己的应用程序上下文,该上下文指示要使用哪些蓖麻油映射文件进行翻译,如何实例化bean等。

How do I tell the system to switch from one context to another? 我如何告诉系统从一个上下文切换到另一个上下文?

Any help would be much appreciated. 任何帮助将非常感激。

Have you looked at using parent and child ApplicationContexts for what you need; 您是否考虑过根据需要使用父级和子级ApplicationContext? where each "simulation library" could be loaded as a child context? 每个“模拟库”可以在哪里作为子上下文加载?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM