refreshing application context after all modules are started in realtime not unit test environment takes more than an hour to create messageSource bean when resolving reference to another bean.
This happens when i add/install a module that adds listener bean(s) and only when i start OpenMRS not when i install the module after starting OpenMRS from the module admin page
I noticed that UserServiceImpl has the List of PrivilegeListeners @Autowired into it. Auto-wiring into services has been the source of big performance issues in the past. I would not be surprised if this is your issue.
Can you try modifying core to load privilege listeners in another way that does not use the @Autowired annotation, and see if that dramatically improves things?
If this is the issue, I suspect that it may actually be okay to use constructor autowiring (but not field autowiring). If you have the inclination to do that experiment and report back, it would be very helpful to know whether that’s the case.
@k.joseph recall I did comment on the PR for adding login/logout listeners to use Context.getRegisteredComponents() to get the list of registered listeners rather than auto wiring them because it has the benefit of addressing the issue @mseaton is trying to point out.
Can you comment on whether doing constructor injection also solved the problem, or did not solve the problem? (Or, didn’t fully test and can’t comment?)