korlibs / korlibs/docs.korge.org

Korinject documentation

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
CSS
Stars
3
Forks
3
PR merge metrics
No merged PRs in 30d

Description

> Actually initially it was simpler and use annotations and runtime reflection to work. So you only had to mark classes as @Singleton or @Prototype + allow to map instances, then use constructors for injection.
> But when I started to target Kotlin Common I needed to stop supporting reflection and annotations, so I had to add mapping methods.
> Usually there are three kind of ways of adding dependencies: singletons, prototypes and instances.
> * Singletons: there is only one instance of the requested class per injector. So each time you request it, you get the same instance. Useful for services.
> * Prototype: no stored instances on the singleton, but everytime you request that class, you get a new instance.
> * Instances: there is a instance in the injector. Works like a singleton, but instead constructing lazily when requested, you provide it at some point. Useful for configuration instances.
> Also the injector is recursive, so you can create children injectors that don't affect the parent, but still allow to map stuff in there.
> In some cases that you know stuff is already mapped and available you can get instances synchronously with getSync.
> So all the methods cover those stuff. There are some inline fun methods repeated that are syntax sugar to be able to omit the class altogether by using the type provided

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue provides Korinject concepts and API names, including singletons, prototypes, instances, child injectors, and getSync, but names no documentation file or test. Start by locating the project's Korinject documentation entry point and compare its coverage with the supplied explanation. Done means the dependency-injection behavior and method variants are documented clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.