Managing your properties

Loading and using properties

At start while calling startKoin function, you have several ways to load external properties into Koin:

  • koin.properties file (in src/main/resources, src/test/resources, assets/koin.properties)
  • parameters in startKoin() with properties parameter
  • environment properties with useEnvironmentProperties parameter

Then, you can get any property with getProperty(<KEY>) in your module or runtime component or inject with by property("key")

Writing properties

Runtime components and KoinComponents can also write properties with setProperty(KEY,VALUE)

Properties vs Parameters?

Properties are static values that can be loaded from external files.

Parameters are values passed via get/inject/viewModel injector functions to pass parameters to Koin bean definitions.