|
|
|
|
|
by EdwardDiego
1214 days ago
|
|
But they're not though? class Foo(@Inject x: SomeType)
Is still a class you can't instantiate without a correct instance of the given type.(If you're talking about field injection, then I agree, that is the devil and must be purged with fire. Constructor injection or none.) And when there's multiple instances of a given type available, a good framework refuses to guess. And I really like compile time DI for surfacing these errors far quicker than the traditional runtime approaches. |
|
It's not that clear with Foo(SomeType). What I usually deal with is:
Now I just want to test that AuthService accepts/rejects a user based on whether they're in the system or not. I want to do something like: > And when there's multiple instances of a given type...(There should always be (in the case that you're writing a test for something))
> a good framework refuses to guess
I do too! I want to manually wire the classes inside main() in the usual case, and manually wire (different combinations) of classes in the tests.