openmrs/openmrs-module-emrapi — pull request #29 by vinayvenu (2014-09-30 06:49:08+00:00)
Title: EA-1 - Make EmrOrderService non-transactional. Move EmrOrderService to autowired

Based on discussions on earlier pull request (https://github.com/openmrs/openmrs-module-emrapi/pull/24).

I tried using different bean names, both annotated with @Openmrsprofile annotation. One problem here is that anything marked with the annotation is loaded by Spring even if it is not specified in xml. If it is specified in xml, Spring creates two beans, one wired with dependencies and another without it. Which means, if I use the annotation, I have to make them @Components and @Autowired.

Right now, I have made EmrOrderService non-transactional. They are autowired and filtered via OpenmrsProfile. It is currently called from another transactional service, so we are fine (atleast for this release). I will also spend some time trying to figure out why the service is slow when transactional beans are autowired.