-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
I would like more documentation (with examples) on Dependency Injection. In what cases and how to use it correctly. Explanation of all Registry
interface methods is required. For example, I don’t understand in what cases the requireAll()
method is needed in practice. In what cases should you use create()
, and in what cases register()
? Why is optional()
needed?
I also don’t understand the meaning of this test:
klite/server/test/klite/DependencyInjectingRegistryTest.kt
Lines 21 to 30 in c85d582
@Test fun `use existing instance even for arguments with default values`() { | |
class Subject(val nonDefault: BodyParser = TextBodyParser(), val default: FormUrlEncodedParser = FormUrlEncodedParser()) | |
val registeredParser = TextBodyParser() | |
registry.register<BodyParser>(registeredParser) | |
expect(registry.require<Subject>()) { | |
its { nonDefault }.toBeTheInstance(registeredParser) | |
its { default }.notToBeTheInstance(registry.require()) | |
} | |
} |
In general, I need yet another small tutorial on DI. And more detailed documentation with real-life examples of your implementation.
Metadata
Metadata
Assignees
Labels
No labels