Dependency Injection for Kotlin

Overview

Kotlin Maven Version CircleCI branch Issues DUB Kotlin Slack

Notice: Kodein and Injekt, much of the same

Since Injekt and Kodein both ended up in a very similar implementation (object registry approach to injection), it makes little sense in having two flavours of the same library for Kotlin. Therefore Injekt is deferring to Kodein. Since Injekt has no known bugs, there is no fear in continuing to use it (and I will fix anyting that shows up), but for additional functionality see Kodein instead.

Libraries such as Klutter will create Kodein modules for their injection modules, same for Kovert. And Typesafe configuration injection from Klutter will also be ported over to Kodein for future releases.

Kodein: https://github.com/SalomonBrys/Kodein

Injekt

Injekt gives you crazy easy Dependency Injection in Kotlin. Although you can probably use it in other JVM languages if you are feeling lucky.

Injekt is NOT inversion of control. It is NOT some mystical class file manipulator. It is NOT complex. But it IS powerful.

Injekt can also load, bind to objects, and inject configuration using Typesafe Config. Read more in the injekt-config-typesafe module.

Quick Samples

Simply register singletons (non-lazy), or factories (lazy) and then inject that values either directly or using Kotlin delegates. For example:

Early in your program (for modules see Injekt "Main" and Packaged Injektables below):

Injekt.addSingleton(HikariDataSource(HikariConfig("some/path/hikari.properties")) as DataSource)
Injekt.addSingletonFactory { PeopleService() }
Injekt.addFactory { ComplexParser.loadFromConfig("some/path/parsing.conf") }

Where PeopleService has default value for constructor parameter that receives the value from Injekt:

class PeopleService(db: DataSource = Injekt.get()) { ... }

Then you can inject PeopleService into your code whenever you want to use it:

class PeopleController {
    fun putPerson(person: Person) {
        val peopelSrv: PeopleService = Injekt.get()
        // ...
    }
}

And when injecting into a property you can use the same style, or instead use delegates:

class PeopleController {
    val peopelSrv: PeopleService by injectLazy() // or injectValue() if immediate
    
    fun putPerson(person: Person) {
        // ...
    }
}

Since PeopleService uses default values in the constructor, you can easily override in tests without requiring an injection model:

class TestPeopleService {
    companion object {
        lateinit var db: DataSource

        @JvmStatic @BeforeClass fun setupTests() {
            db = HikariDataSource(HikariConfig().apply {
                jdbcUrl = "jdbc:h2:mem:test"
            })
        }
    }

    fun testPeopleService() {
        val people = PeopleService(db) // no injection required
        // ...
    }
}

Gradle / Maven Dependnecy

Include the dependency in your Gradle / Maven projects, ones that have Kotlin configured for Kotlin 1.0

Gradle:

compile "uy.kohesive.injekt:injekt-core:1.16.+"

Maven:

<dependency>
    <groupId>uy.kohesive.injekt</groupId>
    <artifactId>injekt-core</artifactId>
    <version>[1.16.0,1.17.0)</version>
</dependency>

It is recommended you set your IDE to auto import * for Injekt packages (if your IDE supports such a feature):

import uy.kohesive.injekt.*
import uy.kohesive.injekt.api.*

Injekt "Main"

At the earliest point in your application startup, you register singletons, factories and your logging factories. For the simplest version of this process, you can use the InjektModule on an object or companion object (from Injekt Examples)

class MyApp {
    companion object : InjektMain() {
        // my app starts here with a static main()
        @JvmStatic public fun main(args: Array<String>) {
            MyApp().run()
        }

        // the InjektModule() will call me back here on a method I override.  And all my functions for registration are
        // easy to find on the receiver class
        override fun InjektRegistrar.registerInjectables() {
            // let's setup my logger first
            addLoggerFactory({ byName -> LoggerFactory.getLogger(byName) }, { byClass -> LoggerFactory.getLogger(byClass) })

            // now some singletons
            addSingleton(HttpServerConfig("0.0.0.0", 8080, 16))
            addSingleton(DatabaseConnectionConfig("db.myhost.com", "sa", "sillycat"))

            // or a lazy singleton factory
            addSingletonFactory { DontCreateUntilWeNeedYa() }

            // or lets only have one database connection per thread, basically a singleton per thread
            addPerThreadFactory { JdbcDatabaseConnection(Injekt.get()) }  // wow, nested inections!!!

            // or give me a new one each time it is injected
            addFactory { LazyDazy() }

            // and we also have factories that use a key (or single parameter) to return an instance
            val pets = listOf(NamedPet("Bongo"), NamedPet("Dancer"), NamedPet("Cheetah")).map { it.name to it}.toMap()
            addPerKeyFactory { petName: String -> pets.get(petName)!! }

            // use prebuilt injectable packages
            importModule(AmazonS3InjektModule)
        }
    }

    ...
}

And once they are registered, anything else in the system can access them, for example as class properties they can be injected using delegates:

    val log: Logger by injectLogger()
    val laziest: LazyDazy by injectLazy()
    val lessLazy: LazyDazy by injectValue()

or directly as assignments both as property declarations and local assignemtns:

    val notLazy1: LazyDazy = Injekt.get()
    val notLazy2 = Injekt.get<LazyDazy>()

And they can be used in constructors and methods as default parameters:

    public fun foo(dbConnectParms: DatabaseConfig = Injekt.get()) { ... }

And since we have registered in the first example a mix of types, including thread specific injections and key/parameter based, here they are in action:

 public fun run() {
        // even local variables can be injected, or rather "got"
        val something = Injekt.get<DontCreateUntilWeNeedYa>()
        startHttpServer()
    }

    // and we can inject into methods by using Kotlin default parameters
    public fun startHttpServer(httpCfg: HttpServerConfig = Injekt.get()) {
        log.debug("HTTP Server starting on ${httpCfg.host}:${httpCfg.port}")
        HttpServer(httpCfg.host, httpCfg.port).withThreads(httpCfg.workerThreads).handleRequest { context ->
            val db: JdbcDatabaseConnection = Injekt.get()    // we have a connection per thread now!

            if (context.params.containsKey("pet")) {
                // inject from a factory that requires a key / parameter
                val pet: NamedPet = Injekt.get(context.params.get("pet")!!)
                // or other form without reified parameters
                val pet2 = Injekt.get<NamedPet>(context.params.get("pet")!!)
            }
        }
    }

Packaged Injektables

Now that you have mastered injections, let's make modules of our application provide their own injectable items. Say our Amazon AWS helper module has a properly configured credential provider chain, and can make clients for us nicely. It is best to have that module decide the construction and make it available to other modules. And it's easy. Create an object that extends InjektModule and then it is pretty much the same as before:

public object AmazonS3InjektModule : InjektModule {
    override fun InjektRegistrar.registerInjectables() {
        addSingletonFactory { AmazonS3Client(defaultCredentialsProviderChain()) }
    }
}

The only difference between an InjektMain and InjektModule object is that a InjektMain is automatically called to initialize, whereas an InjektModule does not do anything until it is imported by another InjektMain or InjektModule. Using InjektModule is simple, go back to the first example at the top of this page and you will see it imported with a simple

 // use prebuilt package
importModule(AmazonS3InjektModule)

Note: if you extend InjektMain you are also a module that can be imported.

Note: If you use scopes (see InjektScope and InjektScopeMain then you should be aware that using InjektMain points at the global scope always).

One Instance Per-Thread Factories -- a tip

When using a factory that is per-thread, be sure not to pass the object to other threads if you really intend for them to be isolated. Lookup of such objects is from ThreadLocal storage and fast, so it is better to keep these objects for shorter durations or in situations guaranteed to stay on the same thread as that which retrieved the object.

Injecting Configuration with Typesafe Config

Injekt + Klutter library can also load, bind to objects, and inject configuration using Typesafe Config. Read more in the klutter/config-typesafe module.

Generics, Erased Type and Injection

It is best to use type inference for all methods in Injekt to let the full type information come through to the system. If the compiler can determine the types, it is likely the full generic information is captured. But if a value passed to Injekt does not have that information available at the calling site, then you can specify the full generic type as a type parameter to the method, for example Injekt.get<MyFullType<WithGenerics<AndMore>>>(). Methods also accept a TypeReference<T> which can be passed around as a means to parameterize and send type information through the system. The helper method fullType<T>() can create a TypeReference for you, for example Injekt.get(fullType<MyFullType<WithGenerics>>()).

It is preferable that you use (in priority order):

  • The inferred forms of Injekt functions that infer their type from the surrounding expression. Do not provide a type unless something breaks.
  • Or if you want to change the type recognized by Injekt, use an explicit generic type for the function someFunction<MyType>().
  • If those are not to your liking, then use the TypeReference version passing in a typeRef<T>() generated TypeReference ... this is your fallback in cases where things need full and exact control.

By doing this, you prevent surprises because you are in full control and it is obvious what types are expected.

Scopes

Injekt allows manual scoping of instances into separate Injekt registries. The global registry, available through the Injekt variable is just one scope that is pre-created for you. You can also create new ones:

val myLocalScope: InjektScope = InjektScope(DefaultRegistrar())

This makes a standalone scope that has no relationship to the global or to others.

But then you can link scopes by creating factories in the new scope that delegate some of the instance creation to another scope, or the global Injekt scope. For example:

// delegate some factories to global Injekt instance
myLocalScope.addSingletonFactory { Injekt.get<SomeSingletonClass>() }
myLocalScope.addFactory { Injekt.get<SomeMultiValueClass>() }

When delegating factories such as this, any multi-value instances will not be cached by any scope since those factories create new instances on every call. For singletons and keyed factories the objects are cached and a reference to those objects will exist in both the local and delegated scopes for any instances requested during its lifecycle.

You can also just use multiple scopes independently without linking or delegation. Fetch some instances from a local scope, others from the global. But you must use each scope independently and be careful of accidentally using the Injekt global variable when not intended.

If you have common factories needed in local scopes, you can easily create a descendent of InjektScope that registers these during its construction.

class MyActivityScope: InjektScope(DefaultRegistrar()) {
    init {
        // override with local value
        addSingletonFactory { SomeSingletonClass() }
        // import other registrations from defined modules
        importModule(OtherModuleWithPrepackagedInjektions)
        // delegate to global scope:
        addSingletonFactory { Injekt.get<SomeOtherSingleton>() }
    }
}

// then in each place you want a local scope
val localScope = MyActivityScope()

// later use the scope
val singly: SomeSingletonClass = localScope.get()
val other: SomeOtherSingleton = localScope.get()

Or using the same model as InjektMain create a descendent of InjektScopedMain that overrides function fun InjektRegistrar.registerInjectables() { ... }, if you prefer to be consistent with modules. For example:

class MyActivityModule: InjektScopedMain(InjektScope(DefaultRegistrar())) {
    override fun InjektRegistrar.registerInjectables() {
        // override with local value
        addSingletonFactory { NotLazy("Freddy") }
        // import other registrations from defined modules
        importModule(OtherModuleWithPrepackagedInjektions)
        // delegate to global scope:
        addSingletonFactory { Injekt.get<SomeOtherSingleton>() }
    }
}

// then in each place you want a local scope
val localScope = MyActivityModule().scope

And you can still use delegated properties, as long as the scope is declared before use in the delegate:

val myProp: SomeClass by localScope.injectValue()

You can use the LocalScoped base class to have local versions of injectValue() and injectLazy() to make it more convenient when injecting members (see code for LocalScoped). This way your syntax stays consistent (see example in tests).

To clear a local scope, drop your reference to the scope and it will garabage collect away. There is no explicit clear method.

For more advanced, and more automatic scope linking / delegation / inheritance, please see issue #31 and provide comments. For propagating a scope into other classes injected into the class declaring the local scope, see the test case referenced from #32

Coming soon... (RoadMap)

  • Linked Scopes, see #31
  • Scoped factories, see #32
  • Materializing object graphs without explicit calls to Injekt
  • Tell me what you would like to see, add Issues here in Github with requests.

Recommended libraries:

Other libraries that we recommend a building blocks for Kotlin applications:

  • Kovenant - promises for Kotlin, easy, fun, and async! (JVM / Android)
  • Klutter - simple, small, useful things for Kotlin

With help from...

Collokia Logo

Comments
  • Generics support

    Generics support

    I have a simple parser interface

    public interface Parser<K> {
        public fun parse(document: Document): K
    }
    

    so I register singletons based on this interface:

    addSingleton(javaClass<Parser<CourseDetails>>(), CourseDetailsParser)
    addSingleton(javaClass<Parser<Array<CourseTitle>>>(), CoursesParser)
    addSingleton(javaClass<Parser<MessageData>>(), MessageParser)
    addSingleton(javaClass<Parser<Array<MessageTitle>>>(), MessagesParser)
    addSingleton(javaClass<Parser<RequestData>>(), RequestParser)
    addSingleton(javaClass<Parser<Array<RequestTitle>>>(), RequestsParser)
    addSingleton(javaClass<Parser<CalendarWeek>>(), WeeklyCalendarParser)
    

    However when I try to get Injekt.get(javaClass<Parser<Array<CourseTitle>>>()) it return me wrong one (CourseDetailsParser instead of CoursesParser)

    enhancement registry-all 
    opened by yoavst 21
  • Android project using injekt-core fails on dex task

    Android project using injekt-core fails on dex task

    Android project using injekt-core can't be dexed because InjektPackage.class exists in injekt-api and injekt-core jars, and dexer can't merge multiple jars containing the same class files.

    bug API Change 
    opened by b3er 6
  • Move Delegates.* extension methods to sub package so they can be imported separately as a group

    Move Delegates.* extension methods to sub package so they can be imported separately as a group

    So that people do not tend to import uy.kohesion.injekt.* can move Delegates extension methods to uy.kohesion.injekt.delegates so that they can be imported from there as a whole and found as a group more easily.

    API Change Usability 
    opened by apatrida 3
  • addSingletonFactory is broken

    addSingletonFactory is broken

    public class Singleton(val count: Int) {
      init {
        println("not really a singleton $count")
      }
    }
    
    public class Magic() {
      public val first: Singleton by Delegates.injectValue()
      public val second: Singleton by Delegates.injectValue()
      public val third: Singleton by Delegates.injectValue()
    }
    
    public object Hello : InjektMain() {
      override fun InjektRegistrar.registerInjectables() {
        val counter = AtomicInteger()
    
        addSingletonFactory {
          Singleton(counter.incrementAndGet())
        }
      }
    
      platformStatic public fun main(args: Array<String>) {
        val test = Magic()
    
        println("first ${test.first.count}")
        println("second ${test.second.count}")
        println("third ${test.third.count}")
      }
    }
    

    Output:

    not really a singleton 1
    not really a singleton 2
    not really a singleton 3
    first 1
    second 1
    third 1
    
    bug 
    opened by nsk-mironov 2
  • How does this library compare to Dagger 2?

    How does this library compare to Dagger 2?

    What are the main pros and cons of this library over Dagger 2? Why should one choose injekt? It would be great to add a short section to README describing this

    opened by netimen 1
  • When reified generics passed in are broken, report a better error

    When reified generics passed in are broken, report a better error

    Currently, when reified generics are broken coming into Injekt, it still tries to use the generic types, even though they contain TypeVariableImpl (both Oracle and OpenJDK) ... This causes crashes later, or if not would cause problems that the generics are really being ignored and something like Something<String> is being seen as Something<T> which basically erases the type. Therefore you don't know what is being injected.

    So, on this happening, fail loudly.

    opened by apatrida 1
  • M13 Kotlin issues to track

    M13 Kotlin issues to track

    • KT-8981 javaClass() upper bounds KClass<T:Any>
    • KT-8982 javaClass() to T::class.java needing T:Any
    • KT-8983 javaClass() to T::class.java ugly
    • KT-8984 for lazy properties with R,T instead of just T

    a question:

    • KT-8985 if T : Any is forced upper bounds, what happens when I want T? and then T isn't optionally nullable, it must be treated as nullable
    registry-all problem 
    opened by apatrida 1
  • Per thread injection should use ThreadLocal storage, or depending on the Registry implementation allow that

    Per thread injection should use ThreadLocal storage, or depending on the Registry implementation allow that

    Currently per thread instantiated instances are pulled from the concurrent maps with the default registry. They could be stored on ThreadLocal storage as an optimization.

    This also COULD be a memory leak if new threads are created all the time and discarded, the current registry would not expire any.

    enhancement registry-all 
    opened by apatrida 1
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    kohesive/injekt now has a Chat Room on Gitter

    @apatrida has just created a chat room. You can visit it here: https://gitter.im/kohesive/injekt.

    This pull-request adds this badge to your README.md:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    opened by gitter-badger 0
  • Activating Open Collective

    Activating Open Collective

    Hi, I'm making updates for Open Collective. Either you or another core contributor signed this repository up for Open Collective. This pull request adds financial contributors from your Open Collective https://opencollective.com/injekt ❤️

    What it does:

    • adds a badge to show the latest number of financial contributors
    • adds a banner displaying contributors to the project on GitHub
    • adds a banner displaying all individuals contributing financially on Open Collective
    • adds a section displaying all organizations contributing financially on Open Collective, with their logo and a link to their website

    P.S: As with any pull request, feel free to comment or suggest changes.

    Thank you for your great contribution to the Open Source community. You are awesome! 🙌 And welcome to the Open Collective community! 😊

    Come chat with us in the #opensource channel on https://slack.opencollective.com - great place to ask questions and share best practices with other Open Source sustainers!

    opened by monkeywithacupcake 0
  • Dependency injection by type alias

    Dependency injection by type alias

    Have you analyzed implementing Dependency injection by type alias?

    object RedisCache { }
    typealias Cache = RedisCache
    

    If we need to change it

    object MongoCache { }
    typealias Cache = MongoCache
    

    It is done in compile time

    opened by raderio 0
  • addSingletonFactory may call its instantiation method multiple times

    addSingletonFactory may call its instantiation method multiple times

    Hello, I've been a long time user of this library and I liked it because of its simplicity. I know it's now deprecated in favor of the other Kotlin's DI libraries but I don't feel the need to change it and I've been hit by this bug I think it's worth mentioning.

    This only happens when injecting the instance from multiple threads and the initialization takes some time.

    Example demostrating the issue:

    class A {
        init {
            Log.w("TAG", "Init A")
            Thread.sleep(1000) // Simulate slow init
        }
    }
    

    In your InjektModule class:

    override fun InjektRegistrar.registerInjectables() {
        ...
    
        addSingletonFactory { A() } 
    }
    

    Then, to cause multiple instances (example using coroutines):

    fun main(args: Array<String>) {
        repeat(5) {
            async { Injekt.get<A>() }
        }
    }
    

    One proposed solution is to change the addSingletonFactory implementation to a lazy so that synchronization is taken into account:

    @Suppress("UNCHECKED_CAST")
    override fun <R: Any> addSingletonFactory(forType: TypeReference<R>, factoryCalledOnce: () -> R) {
        factories.put(forType.type, {
            (existingValues.getOrPut(Instance(forType.type, NOKEY)) { lazy { factoryCalledOnce() } } as Lazy<R>).value
        })
    }
    
    opened by inorichi 0
  • clear Injekt

    clear Injekt

    Hi, during development I've encountered that overriding singletons is not possible (like shown here )

    This came out in unit tests, where different tests needs to have different stubs. It would be nice to have feature either to clear all objects/factories from Injekt before every test, or to override certain singletons.

    What do you think?

    opened by pbochenski 0
  • Compiles and works with Javascript?

    Compiles and works with Javascript?

    Hi!

    I'm looking for a injection-like framework for Kotlin that would compile to Javascript.

    Does your "inject" framework do that?

    Regards, Jørund

    opened by jvskriubakken 0
Releases(v1.3.0)
  • v1.3.0(Aug 21, 2015)

    see CHANGELOG.md for history of changes. And README.md for documentation.

    NEW FEATURE: Configuration Injection w/Typesafe Config. Read more about it in the inject-config-typesafe module.

    Gradle:

    compile "uy.kohesive.injekt:injekt-core:1.3.+"
    compile "uy.kohesive.injekt:injekt-config-typesafe:1.3.+"
    

    Maven:

    <dependency>
        <groupId>uy.kohesive.injekt</groupId>
        <artifactId>injekt-core</artifactId>
        <version>[1.3.0,1.4.0)</version>
    </dependency>
    <dependency>
        <groupId>uy.kohesive.injekt</groupId>
        <artifactId>injekt-config-typesafe</artifactId>
        <version>[1.3.0,1.4.0)</version>
    </dependency>
    

    • Added Configuration injection from Typesafe Config (see README in config-typesafe)
    • Added storage in Injekt scope for addons to work within a scope
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Aug 11, 2015)

    see CHANGELOG.md for history of changes. And README.md for documentation.

    Gradle:

    compile "uy.kohesive.injekt:injekt-core:1.2.+"
    

    Maven:

    <dependency>
        <groupId>uy.kohesive.injekt</groupId>
        <artifactId>injekt-core</artifactId>
        <version>[1.2.0,1.3.0)</version>
    </dependency>
    

    • [BREAKING CHANGE] Fixing #8 - Moved api classes to uy.kohesive.injekt.api package so that separate module jars do not have classes in the same package, breaking use in Android
    • [BREAKING CHANGE] Remove deprecated "injekt_" delegates (replaced with "inject_")
    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Aug 11, 2015)

    see CHANGELOG.md for history of changes. And README.md for documentation.

    Gradle:

    compile "uy.kohesive.injekt:injekt-core:1.1.+"
    

    Maven:

    <dependency>
        <groupId>uy.kohesive.injekt</groupId>
        <artifactId>injekt-core</artifactId>
        <version>[1.1.0,1.2.0)</version>
    </dependency>
    

    Fix for #7 - factories called again when value already existed, even though correct value was returned. Fixed, although in JDK 7 concurrentHashMap doesn't have a way to prevent some chance of a second factory call, although the correct value would still be returned and the additional factory call would be tossed away.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Aug 9, 2015)

    see CHANGELOG.md for history of changes. And README.md for documentation.

    Gradle:

    compile "uy.kohesive.injekt:injekt-core:1.1.+"
    

    Maven:

    <dependency>
        <groupId>uy.kohesive.injekt</groupId>
        <artifactId>injekt-core</artifactId>
        <version>[1.1.0,1.2.0)</version>
    </dependency>
    

    Seperate API from core JAR. Core depends on API. a lot of small changes to structure for having independent scopes for injection, and cleaning. Sorry for the breaks, but they will be tiny little changes to clean up.

    API Changes:

    • new property delegates that require scope to be passed in.

    Core Changes:

    • delegates by default point a the top level scope unless you use the scope-specific version.
    • changed Injekt from object singleton that contained implementation to an var of type InjektScope (no API change, code should compile as-is but does need recompile)
    • [BREAKING CHANGE] changed default registry/factory package to uy.kohesive.injekt.registry.default although unlikely referenced from user code.
    • [BREAKING CHANGE] renamed InjektInstanceFactory to InjektFactory
    • [BREAKING CHANGE] renamed Injekt.Property with delegates removed, use other Delegates.*
    • [BREAKING CHANGE] InkektRegistrar is changed to only be a combination of two interfaces, InjektRegistry and InjektFactory and nothing else.
    • [BREAKING CHANGE] changed InjektMain / InjektScopedMain to also be a module with same registerInjectables method
    • [BREAKING CHANGE] changed exportInjektables to registerInjectables
    • [BREAKING CHANGE] changed other words in method names that used "injekt" to "inject" to be more natural, old versions deprecated to be removed in 1 release
    • Introduced InjektScope which allows different parts of the app to have different injection registries
    • Introduced InjektScopedMain which is like InjektMain but for a specified scope instead of the global scope.
    Source code(tar.gz)
    Source code(zip)
Owner
Kohesive
A kohesive set of Kotlin libraries
Kohesive
Painless Kotlin Dependency Injection

KOtlin DEpendency INjection Kodein-DI is a very simple and yet very useful dependency retrieval container. it is very easy to use and configure. Kodei

null 2.9k Jan 1, 2023
Koin - a pragmatic lightweight dependency injection framework for Kotlin

What is KOIN? - https://insert-koin.io A pragmatic lightweight dependency injection framework for Kotlin developers. Koin is a DSL, a light container

insert-koin.io 7.8k Jan 8, 2023
Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 6 and above, brought to you by Google.

Guice Latest release: 5.0.1 Documentation: User Guide, 5.0.1 javadocs, Latest javadocs Continuous Integration: Mailing Lists: User Mailing List Licens

Google 11.7k Jan 1, 2023
:syringe: Transfuse - A Dependency Injection and Integration framework for Google Android

Transfuse Transfuse is a Java Dependency Injection (DI) and integration library geared specifically for the Google Android API. There are several key

John Ericksen 224 Nov 28, 2022
The dependency injection Dagger basics and the concepts are demonstrated in different branches

In this project we will look at the dependency injection Dagger basics and the concepts are demonstrated in different branches What is an Dependency?

Lloyd Dcosta 6 Dec 16, 2021
A multi-purpose library containing view injection and threading for Android using annotations

SwissKnife A multi-purpose Groovy library containing view injection and threading for Android using annotations. It's based on both ButterKnife and An

Jorge Martin Espinosa 251 Nov 25, 2022
A SharedPreference "injection" library for Android

PreferenceBinder A SharedPreferences binding library for Android. Using annotation processing, this library makes it easy to load SharedPreferences va

Denley Bihari 232 Dec 30, 2022
A fast dependency injector for Android and Java.

Dagger A fast dependency injector for Java and Android. Dagger is a compile-time framework for dependency injection. It uses no reflection or runtime

Google 16.9k Jan 5, 2023
A fast dependency injector for Android and Java.

Dagger 1 A fast dependency injector for Android and Java. Deprecated – Please upgrade to Dagger 2 Square's Dagger 1.x is deprecated in favor of Google

Square 7.3k Jan 5, 2023
DependencyProperty is a dependency resolution library by Delegated Property.

DependencyProperty is a dependency resolution library by Delegated Property. Overview DependencyProperty is simple in defining and

wada811 10 Dec 31, 2022
A scope tree based Dependency Injection (DI) library for Java / Kotlin / Android.

Toothpick (a.k.a T.P. like a teepee) Visit TP wiki ! What is Toothpick ? Toothpick is a scope tree based Dependency Injection (DI) library for Java. I

Stéphane Nicolas 1.1k Jan 1, 2023
Lightweight, minimalistic dependency injection library for Kotlin & Android

‼️ This project is in maintenance mode and not actively developed anymore. For more information read this statement. ‼️ Katana Katana is a lightweight

REWE Digital GmbH 179 Nov 27, 2022
Dependency Injection library for Kotlin Multiplatform, support iOS and Android

Multiplatform-DI library for Kotlin Multiplatform Lightweight dependency injection framework for Kotlin Multiplatform application Dependency injection

Anna Zharkova 32 Nov 10, 2022
Painless Kotlin Dependency Injection

KOtlin DEpendency INjection Kodein-DI is a very simple and yet very useful dependency retrieval container. it is very easy to use and configure. Kodei

null 2.9k Jan 1, 2023
Koin - a pragmatic lightweight dependency injection framework for Kotlin

What is KOIN? - https://insert-koin.io A pragmatic lightweight dependency injection framework for Kotlin developers. Koin is a DSL, a light container

insert-koin.io 7.8k Jan 8, 2023
Lightweight Kotlin DSL dependency injection library

Warehouse DSL Warehouse is a lightweight Kotlin DSL dependency injection library this library has an extremely faster learning curve and more human fr

Osama Raddad 18 Jul 17, 2022
Compile-time dependency injection for Kotlin Multiplatform

Kinzhal Kinzhal is a Kotlin Multiplatform library for compile-time dependency injection. The goal is to emulate basic features of Dagger to achieve si

Artem Daugel-Dauge 59 Dec 21, 2022
Flavor - A lightweight Kotlin dependency injection & service management framework.

flavor A light-weight kotlin dependency injection & service management framework. Flavor is based around guice's design. Usage: Creating a Flavor inst

Subham 4 Oct 31, 2022
HiltTest - Simple hilt dependency injection android kotlin

Using Hilt in your Android app This folder contains the source code for the "Usi

Anbarasu Chinna 1 Jun 3, 2022