Wiki Spaces


Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack


Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


You can add several services via your module by simple adding more than one service beans. See reporting module's moduleApplicationContext for an example.

Modifying Beans


BeanFactoryPostProcessor should never be used in OpenMRS since it breaks our interceptors.

It's possible to modify beans which have been set up by the core or other modules. In order to do that you need to create a bean implementing BeanPostProcessor. You can see an example of that in the MDS module.


  • A few words of warning:  Spring sees all classes loaded by all modules when attempting to load the beans in your moduleApplicationContext.xml file.  It is possible to run into classloading issues if a class referenced in one of your beans (or is a property of one of the classes you're loading through a bean) is the same class as a class from a different module when the two modules expect different versions of this class.  To give an example, this problem was experienced as an incompatibility between the namephonetics and sync modules, where sync expected apache codecs 1.3, and namephonetics expected 1.4  (namephonetics now doesn't try to load the offending incompatible class through Spring).  This manifested itself in the following error:  "loader constraint violation: loader (instance of MyClass) previously initiated loading for a different type with name MyClass"