surm
surm

Reputation: 197

Dependency Injection in play/scala without using constructor injection

After migrating from PlayFramework version 2.4 to version 2.5, I need to inject dependencies.

I'm avoiding to use @Inject for constructor DI as in this the caller class of the class that has @Inject also needs to get the same dependencies injected to call the callee's constructor. This increases code complexity. Please suggest any other way of DI which does not involve injecting to constructor.

Upvotes: 0

Views: 320

Answers (1)

V-Lamp
V-Lamp

Reputation: 1678

MacWire looks like a great tool for constructor injection. It is macro-based and thus typesafe and non invasive. The README page has a very good documentation, definitely worth a look IMHO.

Upvotes: 0

Related Questions