You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adopted Fruit for a recent project, have been a big Guice user in the past. There was a learning curve but I'm overall very happy with it. Big thanks.
The one thing that I desperately miss (from Guice) is providers. I don't want a lambda to re-implement every place (i.e. unit test) I depend on the thing, I don't want to define a whole bunch of global level Component functions. (I tried building everything from Components like the docs suggest at first, it just does not work for me, it gets in the way.)
I just want to be able to .bind<ThingProvider, ThingProviderImpl>(), where ThingProvider defines an (e.g.) public: T Get() (implements FruitProviderInterface?), and then be able to depend on a concrete T anywhere I need it. All the complexity of building that thing is in one place, and I can test it. And I can define a simpler ThingProviderFake for tests of everything that (transitively) depends upon it instead, and bind it with just one line.
To date I've been implementing my providers, and everywhere I depend upon them I manually Get() the T out, turning the provider into the instance. (Except in the one case where I store the provider, because other things need to happen before I can Get() from it.) Would be nice to eliminate that boilerplate.
The text was updated successfully, but these errors were encountered:
Adopted Fruit for a recent project, have been a big Guice user in the past. There was a learning curve but I'm overall very happy with it. Big thanks.
The one thing that I desperately miss (from Guice) is providers. I don't want a lambda to re-implement every place (i.e. unit test) I depend on the thing, I don't want to define a whole bunch of global level Component functions. (I tried building everything from Components like the docs suggest at first, it just does not work for me, it gets in the way.)
I just want to be able to
.bind<ThingProvider, ThingProviderImpl>()
, whereThingProvider
defines an (e.g.)public: T Get()
(implementsFruitProviderInterface
?), and then be able to depend on a concreteT
anywhere I need it. All the complexity of building that thing is in one place, and I can test it. And I can define a simplerThingProviderFake
for tests of everything that (transitively) depends upon it instead, and bind it with just one line.To date I've been implementing my providers, and everywhere I depend upon them I manually
Get()
theT
out, turning the provider into the instance. (Except in the one case where I store the provider, because other things need to happen before I canGet()
from it.) Would be nice to eliminate that boilerplate.The text was updated successfully, but these errors were encountered: