Question:
I’ve created a module (Module A) with a dependency to another module (Module B). But, although I can access the classes from module B, it seems that I cannot access the beans since the injection of autowired dependencies is failing, saying that there are no such bean definitions.
Researching around, I’ve found out that I may have to import the moduleApplicationContext.xml files and config.xml files from module B in order to access the bean definitions and use the beans.
How do I do this in an openmrs module? Any help would be greatly appreciated!
My module is on gitlab so I can’t attach it here.
But I can tell you that it’s just a newly created module with just one controller extending a class from the “Module B”.
The problem is that the class from module B is using a service I created, which I defined as a bean in “Module B’s” moduleApplicationContext.xml.
Do I have to define the bean in Module A’s moduleApplicationContext.xml again?
Yes. And everything is working and configured in “Module B” (The core module). It’s only when I upload the “Module A” that I get this error, when all I did is extend a class from module B.
In config.xml for module A, make sure module B appears in the require_modules or aware_of_modules list, but it’s much more relevant where you are trying to autowire the component, i.e., can the class you’re trying to autowire actually be autowired?