Spring 从另一个项目导入应用程序上下文 [英] Spring import application context from another project
问题描述
我有 2 个项目,其中一个包含在另一个构建路径中,它们都有自己的应用程序上下文来定义他的 bean.
I have 2 projects, one of them is included in the other one build path, both of them have his own application context defining his beans.
我想管理全局事务,所以我必须在一个应用程序上下文中导入它们,但我没有找到方法.
I want to manage Global Transactions so I have to have in one application context the import of both of them, but I didn't find the way to do that.
在不同的项目中可能有 2 个应用程序上下文,并将其中一个导入另一个.
It is possible have 2 application context in different project and import one of them to the other.
如果没有可能,哪个是最好的解决方案?
If there is no possible which would be the best solution?
我想成为 1 中的 2 个项目.
I have think in become the 2 projects in 1.
推荐答案
是的,可以导入;在您的 appcontext xml 之一中:
Yes it is possible to import; in one of your appcontext xmls:
<beans>
<import
resource="classpath*:/META-INF/whatever/root/to/otherAppContext.xml" />
<bean id="beanA" class="..."/>
<bean id="beanB" class="..."/>
</beans>
这篇关于Spring 从另一个项目导入应用程序上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!