Java – Google Guice: provider with parameters
•
Java
I have a constructor that depends on classes a and B I define it as follows:
@Inject TestClass(A a,B b)
Is there any way to manually inject a constructor parameter in Guice?
The problem is that you cannot create an object of class a because it depends on user input I just want to know if Guice supports providers that accept parameters For example, the current object can be provided by the provider Get(), whether Guice has a provider that supports Get (a) object?
Solution
I think what you need is assisted inject
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码