Binding an Interface to its Implementation (Annotated with Singleton) at Multiple location

56 views
Skip to first unread message

Mehul Jain

unread,
May 1, 2020, 4:37:43 AM5/1/20
to google-guice
I am getting error - A binding to XX was already configured at YY. How can I have the same Interface binded to its Implementation at multiple location. The reason I want to do this when I do Unit Testing I want to have binding for each Class that I am testing otherwise I can always get away with having binding at one place.

Jeuxjeux20 Y

unread,
Jul 3, 2020, 10:06:36 AM7/3/20
to google-guice
Hi,

You can try to use  Modules.override(yourModule).with(testModule) to override yourModule's bindings with those in testModule. 

Regards,
jeuxjeux20
Reply all
Reply to author
Forward
0 new messages