Component Scan
Gather definitions declared with Koin definition annotation. Will scan in current package or with the explicit packages names. For scan current package use empty value array or empty string.
The value parameter supports both exact package names and glob patterns:
Exact package names (without wildcards):
Example:
com.example.serviceScans all classes in the specified package and its subpackages.
This is equivalent to the glob pattern
com.example**.
Glob patterns:
Multi-level scan including the root package:
com.example**scans classes incom.exampleas well as in all its subpackages.Multi-level scan excluding the root package:
com.example.**scans only the subpackages ofcom.example, and does not include classes directly incom.example.Single-level wildcard (*):
Example:
com.example.*.serviceMatches exactly one level in the package hierarchy.
For instance, it matches
com.example.user.serviceorcom.example.order.service, but does NOT matchcom.example.serviceorcom.example.user.impl.service.
Wildcards can be combined at any level:
Example:
com.**.service.*dataMatches any package where, at some level, a "service" subpackage contains a package ending with "data".
Example:
com.*.service.**Scans all classes in any subpackage of a package matching
com.<anything>.service.
Parameters
The packages to scan. Specify either an exact package name or a glob pattern. If left empty, the package of the annotated element is used.