Google Guice: Provider with parameters
17,470
I think what you need is Assisted Inject.
Related videos on Youtube
Author by
Abidi
Updated on March 26, 2020Comments
-
Abidi about 4 years
I have a constructor that depends on classes A and B. I defined it like this:
@Inject TestClass(A a, B b)
Is there a way in Guice to have one of the constructor parameters injected manually?
Problem is, the object of class
A
cannot be built as it depends on the user input. I was just wondering if Guice supports a provider that accepts an argument. For example, currently an object can be created byprovider.get()
, does Guice has one that supportprovider.get(a)
?