Replies: 1 comment
-
Using such decorators is pretty handy indeed but I think it goes against the purpose of using dependency injection because you:
IMO, the object graph should be created in a single location: a composition root (note you can have many composition roots per app) Considering this:
IMO, the person who wants to instantiate |
Beta Was this translation helpful? Give feedback.
-
In reference to this: 45f21a3
I'm surprised that Lagom doesn't want to support @Inject as a class decorator, which is pretty standard in javax.inject and Guice.
In my opinion, this:
is worse than:
because it means that the person who wants to instantiate MainClass needs to know that SomeService should be a Singleton. The problem is worse if the class that should be a singleton is deeply nested in the dependencies.
Beta Was this translation helpful? Give feedback.
All reactions