Opening the Koin 1.0.0 — Beta version

Arnaud Giuliani
Jul 9, 2018 · 4 min read
Image for post
Image for post

Hi Koin users! This is it … we are releasing the first public beta version of Koin 1.0.0. Lots of work have been done since our last blog post. The website has been greatly reviewed to give you the most helpful about that. Let’s get into the details to see the new cool things 🙂

Your new bookmark 👉


The 1.0.0-beta-3 version of Koin has been published and is ready for you. As usual, upgrade your Gradle script with the new version number:

// Koin for Kotlin
compile "org.koin:koin-core:1.0.0-beta-3"
// Koin for Unit tests
testCompile "org.koin:koin-test:1.0.0-beta-3"
// Koin for Android
compile "org.koin:koin-android:1.0.0-beta-3"

Check the setup page for the entire list of available Koin modules.

Simplified DSL

The first thing to show you is our simplification of the Koin DSL, by renaming:

  • applicationContext, context to module
  • bean to single

Our target is to make the DSL simple to read and write (and without any conflict with technical terms). We make Koin “modules” and we use some “single” instance definitions, that’s it 👍! Below a quick example of Koin module with Koin 1.0:

Please refer to the Koin DSL Quick Reference or the Koin DSL Documentation for more details.

Core features: better & stronger

Visibility API was not very usable. You can now retrieve a component with its module path: specify the module parameter when using get/inject function (no need of giving a special name):

For definitions and modules, we have now 2 flags to specify additional behavior:

  • createdAtStart: create instance of module/definition with startKoin() function
  • override: definition and module override must be explicit. You have to specify override=true on definition or module that need overriding existing content.

The definition flags documentation chapter gives more details about it.

One last thing to note, is the renaming of the releaseContext() function to release(). This last take a module path to release.

Smarter Injection Parameters

The dependency injection API has been reviewed to allow you to use destructured declaration directly, without forcing you to use a Map of values:

When requesting an instance, just use the parametersOf() function to specify which params to provide. You will find Further reading in injection parameters chapter.

Koin for Java developers

One big news is the coming of the koin-java project. The big idea is to bring easy start & injection to Java with static helpers:

You have to describe Koin module in Kotlin, but all your classes can be in Java! KoinComponent static helper is brought by KoinJavaComponent class and startKoin is ported by KoinJavaStarter. Check out the koin-java Quick Reference page for more info.

Advanced core features

Tired of writing several get() to your constructor? If you are not afraid of using a bit of reflection, the koin-reflect project complete the koin-core project with the build() function to help you build your definition from its primary constructor:

Koin core is purely written without any reflection API. Here is a dedicated side feature, to offer a smarter way of writing definitions at a very small cost: the time to take your constructor and find each parameter of it. If you are not constrained with performances, up to you to test it else keep writing your definition directly with get().

Breaking news for Android

Lots of work on the Android side! Projects have been renamed thanks to their feature inside. We have now the following Android projects:

// Koin for Android
compile "org.koin:koin-android:1.0.0-beta-3"
// Koin Android Scope feature
compile "org.koin:koin-android-scope:1.0.0-beta-3"
// Koin Android ViewModel feature
compile "org.koin:koin-android-viewmodel:1.0.0-beta-3"

koin-android-architecture and koin-androidx has been dropped and won’t be updated anymore.

The newcomer is the scoping feature ported by koin-android-scope which help you bind an Android component’s lifecycle to a module. On the lifecycle’s end, we drop instances from the target module. For this, use the scopedWith() function like below:

The ViewModel Koin feature is done by koin-android-viewmodel project and has the same target as the old koin-android-architecture: bring easy to use out of the box dependency injection for Android Architecture ViewModel components.

One last big thing: starKoin() doesn’t need you to run from Application class anymore. The function needs only a Context instance to run and be started from any Android class if needed:

startKoin(androidContext, appModules)

Another thing to note also, is the change of the DSL function androidApplication() to androidContext() to suit to the new changes

Go get the Android documentation chapter to read all about it!

Unlocking AndroidX version

For those who wants to test the new Android packaging system, we have prepared the AndroidX version of projects that are impacted:

// Koin AndroidX Scope feature
compile "org.koin:koin-androidx-scope:1.0.0-beta-3"
// Koin AndroidX ViewModel feature
compile "org.koin:koin-androidx-viewmodel:1.0.0-beta-3"

Features are the same than the standard package, but with new AndroidX packages.

Other changes

For koin-ktor and koin-spark, we can now use the koin-logger-slf4j logger to help you log with the desired logging implementation (logback, log4j …).

Ktor extensions have been completed with Route and Routing classes.

SparkJava needs you to extends SparkController interface if you want to declare a controller.

Check all the changes on the changelog file 🎯

Getting Started Projects on Github

All the getting started projects are available on Github or are directly downloadable with a zip file. Go check this 🚀

Rendez-vous @

The beta version of the website is available at The following points have been greatly improved:

  • project documentation
  • quick references
  • getting started sections

How can you help us?

This public beta allows us to give you the last version of Koin and you to give us your feedback about all those changes. Don’t hesitate to come to contribute!

Koin developers

Latest news about Koin

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store