Skip to content

Commit ecaf091

Browse files
doc update
1 parent 9ae8f20 commit ecaf091

2 files changed

Lines changed: 34 additions & 5 deletions

File tree

docs/reference/koin-annotations/modules.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,35 @@ The `@Configuration` annotation allows you to organize modules into different co
6363
### Basic Configuration Usage
6464

6565
```kotlin
66-
// Default configuration - these are equivalent
66+
// Put module in default Configuration
6767
@Module
6868
@Configuration
6969
class CoreModule
70+
```
7071

71-
@Module
72-
@Configuration("default")
73-
class CoreModule
72+
:::info
73+
The default configuration is named "default", can be used with `@Configuration` or `@Configuration("default")`
74+
:::
75+
76+
You need to use the `@KoinApplication` to be able to scan modules from configuration:
77+
78+
```kotlin
79+
// module A
80+
@Module
81+
@Configuration
82+
class ModuleA
83+
84+
// module B
85+
@Module
86+
@Configuration
87+
class ModuleB
88+
89+
// module App, scan all @Configuration modules
90+
@KoinApplication
91+
object MyApp
7492
```
7593

94+
7695
### Multiple Configuration Support
7796

7897
A module can be associated with multiple configurations:
@@ -125,7 +144,9 @@ class CoreModule {
125144

126145
### Using Configurations with @KoinApplication
127146

128-
Reference these configurations in your application bootstrap:
147+
By default, the `@KoinApplication` is loading all default configurations (modules tagged with `@Configuration`)
148+
149+
You can also reference these configurations in your application bootstrap:
129150

130151
```kotlin
131152
@KoinApplication(configurations = ["default", "production"])

docs/reference/koin-annotations/options.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ The Koin Annotations KSP processor supports several configuration options that c
3737
- **Description**: Generates ViewModel definitions using `koin-core-viewmodel` main DSL instead of the Android-specific ViewModel. This is enabled by default to provide Kotlin Multiplatform compatibility and use the unified ViewModel API.
3838
- **Usage**: Recommended to keep enabled for all projects. Essential for KMP projects that need ViewModel support across platforms.
3939

40+
### KOIN_EXPORT_DEFINITIONS
41+
- **Type**: Boolean
42+
- **Default**: `true`
43+
- **Description**: Controls whether exported definitions are generated in addition to module-assembled definitions. When disabled, only definitions assembled in modules will be generated, filtering out standalone exported definitions.
44+
- **Usage**: Set to `false` if you want to only generate definitions that are explicitly assembled in modules and exclude standalone exported definitions. Useful for stricter module organization.
45+
4046
## Configuration Examples
4147

4248
### Gradle Kotlin DSL
@@ -48,6 +54,7 @@ ksp {
4854
arg("KOIN_DEFAULT_MODULE", "false")
4955
arg("KOIN_GENERATION_PACKAGE", "com.mycompany.koin.generated")
5056
arg("KOIN_USE_COMPOSE_VIEWMODEL", "true")
57+
arg("KOIN_EXPORT_DEFINITIONS", "true")
5158
}
5259
```
5360

@@ -60,6 +67,7 @@ ksp {
6067
arg("KOIN_DEFAULT_MODULE", "false")
6168
arg("KOIN_GENERATION_PACKAGE", "com.mycompany.koin.generated")
6269
arg("KOIN_USE_COMPOSE_VIEWMODEL", "true")
70+
arg("KOIN_EXPORT_DEFINITIONS", "true")
6371
}
6472
```
6573

0 commit comments

Comments
 (0)