diff --git a/core-kotlin/pom.xml b/core-kotlin/pom.xml
index 0894a57320..5cdb5f700e 100644
--- a/core-kotlin/pom.xml
+++ b/core-kotlin/pom.xml
@@ -61,6 +61,11 @@
3.3.0
pom
+
+ uy.kohesive.injekt
+ injekt-core
+ 1.16.1
+
diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/DelegateInjectionApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/DelegateInjectionApplication.kt
new file mode 100644
index 0000000000..fb9beda621
--- /dev/null
+++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/DelegateInjectionApplication.kt
@@ -0,0 +1,60 @@
+package com.baeldung.injekt
+
+import org.slf4j.LoggerFactory
+import uy.kohesive.injekt.*
+import uy.kohesive.injekt.api.*
+import java.util.*
+
+class DelegateInjectionApplication {
+ companion object : InjektMain() {
+ private val LOG = LoggerFactory.getLogger(DelegateInjectionApplication::class.java)
+ @JvmStatic fun main(args: Array) {
+ DelegateInjectionApplication().run()
+ }
+
+ override fun InjektRegistrar.registerInjectables() {
+ addFactory {
+ val value = FactoryInstance("Factory" + UUID.randomUUID().toString())
+ LOG.info("Constructing instance: {}", value)
+ value
+ }
+
+ addSingletonFactory {
+ val value = SingletonInstance("Singleton" + UUID.randomUUID().toString())
+ LOG.info("Constructing singleton instance: {}", value)
+ value
+ }
+
+ addSingletonFactory { App() }
+ }
+ }
+
+ data class FactoryInstance(val value: String)
+ data class SingletonInstance(val value: String)
+
+ class App {
+ private val instance: FactoryInstance by injectValue()
+ private val lazyInstance: FactoryInstance by injectLazy()
+ private val singleton: SingletonInstance by injectValue()
+ private val lazySingleton: SingletonInstance by injectLazy()
+
+ fun run() {
+ for (i in 1..5) {
+ LOG.info("Instance {}: {}", i, instance)
+ }
+ for (i in 1..5) {
+ LOG.info("Lazy Instance {}: {}", i, lazyInstance)
+ }
+ for (i in 1..5) {
+ LOG.info("Singleton {}: {}", i, singleton)
+ }
+ for (i in 1..5) {
+ LOG.info("Lazy Singleton {}: {}", i, lazySingleton)
+ }
+ }
+ }
+
+ fun run() {
+ Injekt.get().run()
+ }
+}
diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/KeyedApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/KeyedApplication.kt
new file mode 100644
index 0000000000..744459b7fe
--- /dev/null
+++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/KeyedApplication.kt
@@ -0,0 +1,37 @@
+package com.baeldung.injekt
+
+import org.slf4j.LoggerFactory
+import uy.kohesive.injekt.*
+import uy.kohesive.injekt.api.*
+
+class KeyedApplication {
+ companion object : InjektMain() {
+ private val LOG = LoggerFactory.getLogger(KeyedApplication::class.java)
+ @JvmStatic fun main(args: Array) {
+ KeyedApplication().run()
+ }
+
+ override fun InjektRegistrar.registerInjectables() {
+ val configs = mapOf(
+ "google" to Config("googleClientId", "googleClientSecret"),
+ "twitter" to Config("twitterClientId", "twitterClientSecret")
+ )
+ addPerKeyFactory {key -> configs[key]!! }
+
+ addSingletonFactory { App() }
+ }
+ }
+
+ data class Config(val clientId: String, val clientSecret: String)
+
+ class App {
+ fun run() {
+ LOG.info("Google config: {}", Injekt.get("google"))
+ LOG.info("Twitter config: {}", Injekt.get("twitter"))
+ }
+ }
+
+ fun run() {
+ Injekt.get().run()
+ }
+}
diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/ModularApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/ModularApplication.kt
new file mode 100644
index 0000000000..e802f3f6d5
--- /dev/null
+++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/ModularApplication.kt
@@ -0,0 +1,46 @@
+package com.baeldung.injekt
+
+import org.slf4j.LoggerFactory
+import uy.kohesive.injekt.*
+import uy.kohesive.injekt.api.*
+
+class ModularApplication {
+ class ConfigModule(private val port: Int) : InjektModule {
+ override fun InjektRegistrar.registerInjectables() {
+ addSingleton(Config(port))
+ }
+ }
+
+ object ServerModule : InjektModule {
+ override fun InjektRegistrar.registerInjectables() {
+ addSingletonFactory { Server(Injekt.get()) }
+ }
+ }
+
+ companion object : InjektMain() {
+ private val LOG = LoggerFactory.getLogger(Server::class.java)
+ @JvmStatic fun main(args: Array) {
+ ModularApplication().run()
+ }
+
+ override fun InjektRegistrar.registerInjectables() {
+ importModule(ConfigModule(12345))
+ importModule(ServerModule)
+ }
+ }
+
+ data class Config(
+ val port: Int
+ )
+
+ class Server(private val config: Config) {
+
+ fun start() {
+ LOG.info("Starting server on ${config.port}")
+ }
+ }
+
+ fun run() {
+ Injekt.get().start()
+ }
+}
diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/PerThreadApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/PerThreadApplication.kt
new file mode 100644
index 0000000000..a42f314349
--- /dev/null
+++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/PerThreadApplication.kt
@@ -0,0 +1,48 @@
+package com.baeldung.injekt
+
+import org.slf4j.LoggerFactory
+import uy.kohesive.injekt.*
+import uy.kohesive.injekt.api.*
+import java.util.*
+import java.util.concurrent.Executors
+import java.util.concurrent.TimeUnit
+
+class PerThreadApplication {
+ companion object : InjektMain() {
+ private val LOG = LoggerFactory.getLogger(PerThreadApplication::class.java)
+ @JvmStatic fun main(args: Array) {
+ PerThreadApplication().run()
+ }
+
+ override fun InjektRegistrar.registerInjectables() {
+ addPerThreadFactory {
+ val value = FactoryInstance(UUID.randomUUID().toString())
+ LOG.info("Constructing instance: {}", value)
+ value
+ }
+
+ addSingletonFactory { App() }
+ }
+ }
+
+ data class FactoryInstance(val value: String)
+
+ class App {
+ fun run() {
+ val threadPool = Executors.newFixedThreadPool(5)
+
+ for (i in 1..20) {
+ threadPool.submit {
+ val instance = Injekt.get()
+ LOG.info("Value for thread {}: {}", Thread.currentThread().id, instance)
+ TimeUnit.MILLISECONDS.sleep(100)
+ }
+ }
+ threadPool.awaitTermination(10, TimeUnit.SECONDS)
+ }
+ }
+
+ fun run() {
+ Injekt.get().run()
+ }
+}
diff --git a/core-kotlin/src/main/kotlin/com/baeldung/injekt/SimpleApplication.kt b/core-kotlin/src/main/kotlin/com/baeldung/injekt/SimpleApplication.kt
new file mode 100644
index 0000000000..2b07cd059f
--- /dev/null
+++ b/core-kotlin/src/main/kotlin/com/baeldung/injekt/SimpleApplication.kt
@@ -0,0 +1,34 @@
+package com.baeldung.injekt
+
+import org.slf4j.LoggerFactory
+import uy.kohesive.injekt.*
+import uy.kohesive.injekt.api.*
+
+class SimpleApplication {
+ companion object : InjektMain() {
+ private val LOG = LoggerFactory.getLogger(Server::class.java)
+ @JvmStatic fun main(args: Array) {
+ SimpleApplication().run()
+ }
+
+ override fun InjektRegistrar.registerInjectables() {
+ addSingleton(Config(12345))
+ addSingletonFactory { Server(Injekt.get()) }
+ }
+ }
+
+ data class Config(
+ val port: Int
+ )
+
+ class Server(private val config: Config) {
+
+ fun start() {
+ LOG.info("Starting server on ${config.port}")
+ }
+ }
+
+ fun run() {
+ Injekt.get().start()
+ }
+}