Skip to content

Dependency Injection docs #51

@webleaf

Description

@webleaf

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:

@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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions