Shedinja has been moved to the Tegral project under the name "Tegral DI". See here for more information on Tegral DI.
This repository is no longer maintained as a result.
Previous README below.
.
.
.
Inspired by Koin, Shedinja is a simple, safe and easy-to-use dependency injection library with extremely flexible internals.
⚡ This framework is experimental and under heavy development. As such, it should not be considered stable and should not be used in production environments.
Using Shedinja is simple:
- Add a
scope: InjectionScope
parameter to your class.- This is only required if you would like to inject components into your class. If your class does not require injection, such a parameter is not necessary.
- Define your injectable elements, either one-by-one or grouped in modules.
- Create an environment.
- Profit!
class Repository {
// ...
}
class Service(scope: InjectionScope) {
private val repo: Repository by scope()
// ...
}
data class Configuration(val someUrl: String)
val appModule = module {
put(::Repository)
put(::Service)
put { Configuration("https://example.com") }
}
val env = shedinja { put(appModule) }