The no-framework Scala Dependency Injection framework

Adam Warski

11 Dec 2013.0 minutes read

This talk has been (or will be) presented at:
* JUG Łódź

Using a DI framework/container may seem obvious. But when was the last time you considered why do you really need one?
After all, "dependency injection" is just a fancy name for passing arguments to a constructor. In the talk we'll walk
through some of the features of DI containers and see if we can replace them with pure Scala code.

We'll start with "manual" DI, followed with using MacWire to generate the wiring code for us. Then we'll proceed to a no-framework scopes
implementation (e. g. request or session), which are very useful in web applications. We will also discuss possibilities
of adding interceptors using macros.

And finally, we'll see how to use traits to create and compose modules (similar
to the module concept known from Guice), which can be viewed as a simplified cake pattern. As MacWire heavily uses macros,
as a bonus, I'll explain how Scala Macros work and when they can be useful.

Slides

Video

Blog Comments powered by Disqus.