Scaldi provides simple and elegant way to do dependency injection in Scala. By using expressive power of the Scala language it defines intuitive and idiomatic DSL for binding and injecting dependencies. It is very extensible library, so you can easily extend or customize almost any aspect of it. Some of the more unique Scaldi features are advanced module composition and conditional bindings which definitely will help you build all kinds of applications - from small command-line tools to big non-trivial web applications. Not to mention Scaldi also nicely integrates with Akka and Play.

Scaldi — is Scala dependency injection library. Basically Scala already have everything you need for dependency injection. But still some things can be made easier. Goal of the project is to provide more standard and easy way to make dependency injection in Scala projects consuming power of the Scala language. With Scaldi you can define your application modules in pure Scala without any annotations or XML.

There are 3 most important traits that you need to know, in order to make dependency injection with Scaldi:

Injector: it's a container for the bindings, that you have defined in the module.

Module: gives you nice syntax to create bindings with bind and binding. Module also extends Injector trait and implicit Injector instance always available when you are defining your bindings

Injectable: the only responsibility of this trait is to provide you with inject function (so it just provides nice syntax for injecting dependencies). It’s important to understand, that it’s the only purpose of it. So it is completely stateless and knows nothing about actual bindings you have defined in the module. In order to actually find and inject dependencies, inject function always takes an implicit parameter of type Injector.

8 yıl önce eklendi

Contents related to 'Scaldi'

Simple Injector: Simple Injector make it easy to implement the dependency injection pattern with loosely coupled components using Simple Injector.

- Scikit-learn
- Bower
- Apache Spark
- Apache Chukwa
- Scaldi
- Redis
- CruiseControl and CruiseControl.Net (CCNet)
- Financial Information Exchange (FIX) API
- Portable Operating System Interface (POSIX)
- Reguler Expression (RegEx)
- Metaprogramming
- Windows Communication Foundation (WCF)
- WebLogic
- Wildcards
- Message-oriented middleware (MOM)
- Team Foundation Server (TFS)
- CppUnit
- Google Protocol Buffer (ProtocolBuf)