Created
August 18, 2022 02:38
-
-
Save stella6767/f38c81d6828f5b644ac3465bc59f65be to your computer and use it in GitHub Desktop.
Inject into static field Kotlin/Spring Boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
class GlobalValue { | |
companion object { | |
@JvmField | |
lateinit var DATABASE: String | |
} | |
@Value("\${mongodb.db}") | |
fun setDatabase(db: String) { | |
DATABASE = db; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment