views:

45

answers:

1

Is there a way to create a global guice module? so whenever someone calls the CreateInjector method of the Guice class it will get a specific "global" module?

I am trying to do this because I have a set of compiled classes in a JAR that use the following:

@Inject
MyInterface.dosomething();

and I would like to be able to, in the project that includes this JAR, make it so that whenever that statement is encountered -> Guice will automatically send in the (singleton) instance of the class that I want. But I want to be able to define what that class is in the project that is including this JAR and not in the JAR itself...

Is this possible? If so how could I accomplish this?

Thanks,

ExtremeCoder

A: 

All of the classes involved are subclasses of a single other class. What I did was simply make a static field in that super class and inject that at the program's startup.

ExtremeCoder
What do you mean by that?
gpampara