Spring - Use applicationContext from .jar file added as a dependency
Imagine a situation where there are 2 independent modules - Module A and
B. Both of them are constructed using Spring. Each of them have its own
applicationContext - Module A works with applicationContextA and B -
applicationContextB.
Module A contains facade class - defined in a bean moduleAFacade - that
provides some functionality of Module A. Module B needs to access the
functionality of Module A.
Let's have Module A added as a .jar dependency in the module B. There is
this construction in applicationContextB:
<bean id="moduleBBeanUsingModuleAfacade" class="com.example.moduleB">
<property name="moduleAFacadeObject" ref="moduleAFacade" />
</bean>
But applicationContext of Module A is not accessible from Module B's
appContext directly. I need to use something like
<import resource="classpath*:moduleAApplicationContext.xml" />
Are there any other methods to access application contexts of .jar files
added to the project as dependency?
Are there some best practises how to accomplish the task?
No comments:
Post a Comment