How to refer to beans defined in moduleApplicationContext from webModuleApplicationContext?

Platform Version: 1.9.9 Module: radiologydcm4chee

I was wondering, if anybody is able to help me with my problem:

I have a bean defined in the moduleApplicationContext.xml file in the api part and I need to refer to it from within another bean in webModuleApplicationContext in omod. I am unable to import the resource:

<import resource="classpath*:moduleApplicationContext.xml"/>

because the moduleApplicationContext.xml is not accessible via classpath. How can I import this resource to my xml file?

Thanks in advance!

My understanding is that you do not need to import the resource yourself, but you can assume that the OpenMRS module framework is going to include both your moduleApplicationContext.xml and webModuleApplicationContext.xml in the Spring application context.

So, you can just refer to any bean defined in any of the other xml files that you know will be loaded. Your IDE may flag this as a warning, but it should work when actually deployed to the application. And it should work in any test that extends BaseModuleWebContextSensitiveTest.


Thank you very much for your response! You are absolutely right, I solved the original problem, the cause was, that my bean was not defined the right way.