Switch from koin to micronaut-inject
This commit is contained in:
@@ -2,8 +2,10 @@ import be.simplenotes.Libs
|
||||
|
||||
plugins {
|
||||
id("be.simplenotes.base")
|
||||
kotlin("kapt")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(Libs.koinCore)
|
||||
implementation(Libs.micronaut)
|
||||
kapt(Libs.micronautProcessor)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package be.simplenotes.config
|
||||
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class ConfigLoader {
|
||||
//region Config loading
|
||||
private val properties: Properties = javaClass
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
package be.simplenotes.config
|
||||
|
||||
import org.koin.dsl.module
|
||||
import io.micronaut.context.annotation.Factory
|
||||
import javax.inject.Singleton
|
||||
|
||||
val configModule = module {
|
||||
single { ConfigLoader() }
|
||||
single { get<ConfigLoader>().dataSourceConfig }
|
||||
single { get<ConfigLoader>().jwtConfig }
|
||||
single { get<ConfigLoader>().serverConfig }
|
||||
@Factory
|
||||
class ConfigModule {
|
||||
|
||||
@Singleton
|
||||
internal fun dataSourceConfig(configLoader: ConfigLoader) = configLoader.dataSourceConfig
|
||||
|
||||
@Singleton
|
||||
internal fun jwtConfig(configLoader: ConfigLoader) = configLoader.jwtConfig
|
||||
|
||||
@Singleton
|
||||
internal fun serverConfig(configLoader: ConfigLoader) = configLoader.serverConfig
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user