Michel Michel - 1 year ago 92
Java Question

Spring import application context from another project

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.

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?

I have think in become the 2 projects in 1.

Answer Source

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>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download