Guice Singletons are weird for me
First I thought that
IService ser = Guice.createInjector().getInstance(IService.class);
System.out.println("ser=" + ser);
ser = Guice.createInjector().getInstance(IService.class);
System.out.println("ser=" + ser);
will work as singleton, but it returns
ser=Service2@1975b59
ser=Service2@1f934ad
its ok, it doesnt have to be easy.
Injector injector = Guice.createInjector();
IService ser = injector.getInstance(IService.class);
System.out.println("ser=" + ser);
ser = injector.getInstance(IService.class);
System.out.println("ser=" + ser);
works as singleton
ser=Service2@1975b59
ser=Service2@1975b59
So i need to have static field with Injector(Singleton for Singletons)
how do i pass to it Module for testing?