File tree Expand file tree Collapse file tree
src/main/kotlin/co/statu/rule/database Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import io.vertx.core.json.JsonObject
1010import io.vertx.jdbcclient.JDBCPool
1111import org.slf4j.Logger
1212import org.springframework.beans.factory.config.ConfigurableBeanFactory
13+ import org.springframework.context.annotation.Lazy
1314import org.springframework.context.annotation.Scope
1415import org.springframework.stereotype.Component
1516import java.sql.BatchUpdateException
@@ -20,12 +21,8 @@ import kotlin.system.exitProcess
2021class DatabaseManager (
2122 private val vertx : Vertx ,
2223 private val logger : Logger ,
23- private val databasePlugin : DatabasePlugin
24+ @Lazy private val pluginConfigManager : PluginConfigManager < DatabaseConfig >
2425) {
25- private val pluginConfigManager by lazy {
26- databasePlugin.pluginBeanContext.getBean(PluginConfigManager ::class .java) as PluginConfigManager <DatabaseConfig >
27- }
28-
2926 private lateinit var pool: JDBCPool
3027
3128 private val tables = mutableMapOf<ParsekPlugin , MutableList <Dao <* >>>()
Original file line number Diff line number Diff line change 1- package co.statu.rule.database
1+ package co.statu.rule.database.event
22
33import co.statu.parsek.PluginEventManager
44import co.statu.parsek.api.annotation.EventListener
55import co.statu.parsek.api.config.PluginConfigManager
66import co.statu.parsek.api.event.CoreEventListener
77import co.statu.parsek.config.ConfigManager
8- import co.statu.rule.database.event.DatabaseEventListener
8+ import co.statu.rule.database.DatabaseConfig
9+ import co.statu.rule.database.DatabaseManager
10+ import co.statu.rule.database.DatabasePlugin
911import org.slf4j.Logger
12+ import org.springframework.context.annotation.Lazy
1013
1114@EventListener
1215class CoreEventHandler (
1316 private val logger : Logger ,
1417 private val databasePlugin : DatabasePlugin ,
18+ @Lazy private val databaseManager : DatabaseManager
1519) : CoreEventListener {
16- private val databaseManager by lazy {
17- databasePlugin.pluginBeanContext.getBean(DatabaseManager ::class .java)
18- }
19-
2020 override suspend fun onConfigManagerReady (configManager : ConfigManager ) {
2121 val pluginConfigManager = PluginConfigManager (
2222 databasePlugin,
You can’t perform that action at this time.
0 commit comments