Controller with the Same Name in Different Modules - Cohort & HTML Widgets

I am in the process of integrating the openmrs-module-cohort and I have run into a situation of 2 controllers (PatientSearchController) have the same name hence cannot be loaded by Spring.

Any advice on how to handle this for this instance and going forward

Why not just rename it? :smile:

@dkayiwa Please can you show me an example of the recommended approach for webservice API test with mocking that I can use

You should specify a name for at least one of the controllers so that spring doesn’t use its default naming for beans, like @Component annotation the @Controller annotation has a value attribute for this purpose.

@wyclif Do advise on the two:

I think Cohort module is easier to change at this time

@ssmusoke there is no need to rename any of the controllers, in my response I mentioned that all you need to do is to specify a name for one of the controllers as shown below:

    public class MyController {

Possibly do it for both controllers just in case there is another module with a controller with the same name.